| Index: tools/dom/scripts/idlnode.py
|
| diff --git a/tools/dom/scripts/idlnode.py b/tools/dom/scripts/idlnode.py
|
| index 8121d0129c6ca62afc8406b07246a35e14a50079..2d8198878e9e7155386a34c1640875228951dd53 100755
|
| --- a/tools/dom/scripts/idlnode.py
|
| +++ b/tools/dom/scripts/idlnode.py
|
| @@ -12,6 +12,23 @@ import dependency
|
|
|
| new_asts = {}
|
|
|
| +# Ugly but Chrome IDLs can reference typedefs in any IDL w/o an include. So we
|
| +# need to remember any typedef seen then alias any reference to a typedef.
|
| +typeDefsFixup = []
|
| +
|
| +def _resolveTypedef(type):
|
| + """ Given a type if it's a known typedef (only typedef's that aren't union)
|
| + are remembered for fixup. typedefs that are union type are mapped to
|
| + any so those we don't need to alias. typedefs referenced in the file
|
| + where the typedef was defined are automatically aliased to the real type.
|
| + This resolves typedef where the declaration is in another IDL file.
|
| + """
|
| + for typedef in typeDefsFixup:
|
| + if typedef.id == type.id:
|
| + return typedef.type
|
| +
|
| + return type
|
| +
|
|
|
| _operation_suffix_map = {
|
| '__getter__': "Getter",
|
| @@ -406,6 +423,9 @@ 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
|
| + typeDefsFixup.append(IDLTypeDef(typedef_type))
|
|
|
| self.enums = self._convert_all(ast, 'Enum', IDLEnum)
|
|
|
| @@ -748,6 +768,8 @@ class IDLMember(IDLNode):
|
| IDLNode.__init__(self, ast)
|
|
|
| self.type = self._convert_first(ast, 'Type', IDLType)
|
| + self.type = _resolveTypedef(self.type)
|
| +
|
| self._convert_ext_attrs(ast)
|
| self._convert_annotations(ast)
|
| self.doc_js_interface_name = doc_js_interface_name
|
| @@ -756,13 +778,13 @@ class IDLMember(IDLNode):
|
| 'DartSuppress' in self.ext_attrs
|
| self.is_static = self._has(ast, 'Static')
|
|
|
| -
|
| class IDLOperation(IDLMember):
|
| """IDLNode specialization for 'type name(args)' declarations."""
|
| def __init__(self, ast, doc_js_interface_name):
|
| IDLMember.__init__(self, ast, doc_js_interface_name)
|
|
|
| self.type = self._convert_first(ast, 'ReturnType', IDLType)
|
| + self.type = _resolveTypedef(self.type)
|
| self.arguments = self._convert_all(ast, 'Argument', IDLArgument)
|
| self.specials = self._find_all(ast, 'Special')
|
| # Special case: there are getters of the form
|
| @@ -840,6 +862,8 @@ class IDLArgument(IDLNode):
|
| self.default_value_is_null = False
|
|
|
| self.type = self._convert_first(ast, 'Type', IDLType)
|
| + self.type = _resolveTypedef(self.type)
|
| +
|
| self.optional = self._has(ast, 'Optional')
|
| self._convert_ext_attrs(ast)
|
| # TODO(vsm): Recover this from the type instead.
|
|
|