mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:58:29 +00:00
Typedefs and IDL file order between platforms could generated different files.
TBR=alanknight@google.com,vsm@google.com Review-Url: https://codereview.chromium.org/2948493002 .
This commit is contained in:
parent
bcf179c9fa
commit
8ab1a87aba
|
@ -1467,13 +1467,13 @@ _idl_type_registry = monitored.Dict('generator._idl_type_registry', {
|
|||
'MediaKeySystemConfiguration': TypeData(clazz='Primitive', dart_type='Map'),
|
||||
'DOMTimeStamp': TypeData(clazz='Primitive', dart_type='int', native_type='unsigned long long'),
|
||||
'object': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptValue'),
|
||||
'ObjectArray': TypeData(clazz='Primitive', dart_type='List'),
|
||||
'PositionOptions': TypeData(clazz='Primitive', dart_type='Object'),
|
||||
# TODO(sra): Come up with some meaningful name so that where this appears in
|
||||
# the documentation, the user is made aware that only a limited subset of
|
||||
# serializable types are actually permitted.
|
||||
'SerializedScriptValue': TypeData(clazz='Primitive', dart_type='dynamic'),
|
||||
'sequence': TypeData(clazz='Primitive', dart_type='List'),
|
||||
'sequence<any>': TypeData(clazz='Primitive', dart_type='List'),
|
||||
'void': TypeData(clazz='Primitive', dart_type='void'),
|
||||
|
||||
'CSSRule': TypeData(clazz='Interface', conversion_includes=['CSSImportRule']),
|
||||
|
@ -1610,7 +1610,8 @@ class TypeRegistry(object):
|
|||
|
||||
def _TypeInfo(self, type_name):
|
||||
match = re.match(r'(?:sequence<([\w ]+)>|(\w+)\[\])$', type_name)
|
||||
if match:
|
||||
# sequence<any> should not be List<Object>
|
||||
if match and match.group(1) != 'any':
|
||||
type_data = TypeData('Sequence')
|
||||
if self.HasTypeDef(match.group(1) or match.group(2)):
|
||||
# It's a typedef (union)
|
||||
|
|
18
tools/dom/scripts/idlnode.py
Executable file → Normal file
18
tools/dom/scripts/idlnode.py
Executable file → Normal file
|
@ -384,6 +384,16 @@ class IDLFile(IDLNode):
|
|||
|
||||
# Report of union types mapped to any.
|
||||
|
||||
# Remember all the typedefs before we start walking the AST. Some
|
||||
# IDLs now have typedefs before interfaces. So we need to remember
|
||||
# to resolve the typedefs.
|
||||
self.typeDefs = self._convert_all(ast, 'TypeDef', IDLTypeDef)
|
||||
for typedefName in ast.typedefs:
|
||||
typedef_type = ast.typedefs[typedefName]
|
||||
# Ignore unions and dictionaries for now we just want normal typedefs to resolve our arguments/types.
|
||||
if not(isinstance(typedef_type.idl_type, IdlUnionType)) and not(typedef_type.idl_type.base_type == 'Dictionary'):
|
||||
_addTypedef(IDLTypeDef(typedef_type))
|
||||
|
||||
self.interfaces = self._convert_all(ast, 'Interface', IDLInterface)
|
||||
self.dictionaries = self._convert_all(ast, 'Dictionary', IDLDictionary)
|
||||
|
||||
|
@ -432,10 +442,7 @@ class IDLFile(IDLNode):
|
|||
self.implementsStatements = self._convert_all(ast, 'ImplStmt',
|
||||
IDLImplementsStatement)
|
||||
|
||||
# No reason to handle typedef they're already aliased in Blink's AST.
|
||||
self.typeDefs = [] if is_blink else self._convert_all(ast, 'TypeDef', IDLTypeDef)
|
||||
|
||||
# Hack to record typedefs that are unions.
|
||||
# Record typedefs that are unions.
|
||||
for typedefName in ast.typedefs:
|
||||
typedef_type = ast.typedefs[typedefName]
|
||||
if isinstance(typedef_type.idl_type, IdlUnionType):
|
||||
|
@ -443,9 +450,6 @@ class IDLFile(IDLNode):
|
|||
elif typedef_type.idl_type.base_type == 'Dictionary':
|
||||
dictionary = IDLDictionary(typedef_type, True)
|
||||
self.dictionaries.append(dictionary)
|
||||
else:
|
||||
# All other typedefs we record
|
||||
_addTypedef(IDLTypeDef(typedef_type))
|
||||
|
||||
self.enums = self._convert_all(ast, 'Enum', IDLEnum)
|
||||
|
||||
|
|
Loading…
Reference in a new issue