Properly keep track of our union typedef support in WebIDL.py

This commit is contained in:
Anthony Ramine 2016-09-26 13:08:17 +02:00
parent f763eca344
commit 4c084cefa3
2 changed files with 23 additions and 0 deletions

View file

@ -0,0 +1,22 @@
--- WebIDL.py
+++ WebIDL.py
@@ -2481,10 +2481,18 @@ class IDLUnionType(IDLType):
return type.name
for (i, type) in enumerate(self.memberTypes):
+ # Exclude typedefs because if given "typedef (B or C) test",
+ # we want AOrTest, not AOrBOrC
+ if not type.isComplete() and not isinstance(type, IDLTypedefType):
+ self.memberTypes[i] = type.complete(scope)
+
+ self.name = "Or".join(typeName(type) for type in self.memberTypes)
+
+ # We do this again to complete the typedef types
+ for (i, type) in enumerate(self.memberTypes):
if not type.isComplete():
self.memberTypes[i] = type.complete(scope)
- self.name = "Or".join(typeName(type) for type in self.memberTypes)
self.flatMemberTypes = list(self.memberTypes)
i = 0
while i < len(self.flatMemberTypes):

View file

@ -4,6 +4,7 @@ patch < debug.patch
patch < pref-main-thread.patch
patch < callback-location.patch
patch < bytestring.patch
patch < union-typedef.patch
wget https://hg.mozilla.org/mozilla-central/archive/tip.tar.gz/dom/bindings/parser/tests/ -O tests.tar.gz
rm -r tests