Index: Source/bindings/scripts/idl_types.py |
diff --git a/Source/bindings/scripts/idl_types.py b/Source/bindings/scripts/idl_types.py |
index 0db2514f58d815cc91bd884c38f4394855e71607..5d776a7172c563d978594851d86f0b59588d4288 100644 |
--- a/Source/bindings/scripts/idl_types.py |
+++ b/Source/bindings/scripts/idl_types.py |
@@ -124,6 +124,11 @@ class IdlTypeBase(object): |
raise NotImplementedError( |
'resolve_typedefs should be defined in subclasses') |
+ def idl_types(self): |
+ """A generator which yields IdlTypes which are referenced from |self|, |
+ including itself.""" |
+ yield self |
+ |
################################################################################ |
# IdlType |
@@ -321,6 +326,12 @@ class IdlUnionType(IdlTypeBase): |
for member_type in self.member_types] |
return self |
+ def idl_types(self): |
+ yield self |
+ for member_type in self.member_types: |
+ for idl_type in member_type.idl_types(): |
+ yield idl_type |
+ |
################################################################################ |
# IdlArrayOrSequenceType, IdlArrayType, IdlSequenceType |
@@ -357,6 +368,11 @@ class IdlArrayOrSequenceType(IdlTypeBase): |
def enum_type(self): |
return self.element_type.enum_type |
+ def idl_types(self): |
+ yield self |
+ for idl_type in self.element_type.idl_types(): |
+ yield idl_type |
+ |
class IdlArrayType(IdlArrayOrSequenceType): |
def __init__(self, element_type): |
@@ -421,3 +437,8 @@ class IdlNullableType(IdlTypeBase): |
def resolve_typedefs(self, typedefs): |
self.inner_type = self.inner_type.resolve_typedefs(typedefs) |
return self |
+ |
+ def idl_types(self): |
+ yield self |
+ for idl_type in self.inner_type.idl_types(): |
+ yield idl_type |