Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: Source/bindings/scripts/code_generator_v8.py

Issue 924443002: IDL: Support iterable<>/maplike<>/setlike<> referencing typedefs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix the problem Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/code_generator_v8.py
diff --git a/Source/bindings/scripts/code_generator_v8.py b/Source/bindings/scripts/code_generator_v8.py
index b894d18e53e3f9d047a3beb280b03df4e4f22942..42fb98cfffb7dc58d5df3f95c3ba9be00664eb7a 100644
--- a/Source/bindings/scripts/code_generator_v8.py
+++ b/Source/bindings/scripts/code_generator_v8.py
@@ -140,31 +140,23 @@ class TypedefResolver(Visitor):
def _resolve_typedefs(self, typed_object):
"""Resolve typedefs to actual types in the object."""
- idl_type = typed_object.idl_type
- if not idl_type:
- return
- resolved_idl_type = idl_type.resolve_typedefs(self.typedefs)
- if resolved_idl_type.is_union_type:
- self.additional_includes.add(
- self.info_provider.include_path_for_union_types)
- # Need to re-assign typed_object.idl_type, not just mutate idl_type,
- # since type(idl_type) may change.
- typed_object.idl_type = resolved_idl_type
-
- def visit_callback_function(self, callback_function):
- self._resolve_typedefs(callback_function)
-
- def visit_attribute(self, attribute):
- self._resolve_typedefs(attribute)
-
- def visit_constant(self, constant):
- self._resolve_typedefs(constant)
-
- def visit_operation(self, operation):
- self._resolve_typedefs(operation)
-
- def visit_argument(self, argument):
- self._resolve_typedefs(argument)
+ for attribute_name in typed_object.idl_type_attributes:
+ try:
+ idl_type = getattr(typed_object, attribute_name)
+ except AttributeError:
+ continue
+ if not idl_type:
+ continue
+ resolved_idl_type = idl_type.resolve_typedefs(self.typedefs)
+ if resolved_idl_type.is_union_type:
+ self.additional_includes.add(
+ self.info_provider.include_path_for_union_types)
+ # Need to re-assign the attribute, not just mutate idl_type, since
+ # type(idl_type) may change.
+ setattr(typed_object, attribute_name, resolved_idl_type)
+
+ def visit_typed_object(self, typed_object):
+ self._resolve_typedefs(typed_object)
class CodeGeneratorBase(object):
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_definitions.py » ('j') | Source/bindings/scripts/idl_definitions.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698