mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Support using typedefs with nullable unions.
This commit is contained in:
parent
8ca1383c41
commit
35bc171a05
2 changed files with 3 additions and 1 deletions
|
@ -6122,7 +6122,8 @@ class CGBindingRoot(CGThing):
|
||||||
|
|
||||||
# Do codegen for all the typdefs
|
# Do codegen for all the typdefs
|
||||||
for t in typedefs:
|
for t in typedefs:
|
||||||
if t.innerType.isUnion():
|
if t.innerType.isUnion() and not t.innerType.nullable():
|
||||||
|
# Allow using the typedef's name for accessing variants.
|
||||||
cgthings.extend([CGGeneric("\npub use dom::bindings::codegen::UnionTypes::%s as %s;\n\n" %
|
cgthings.extend([CGGeneric("\npub use dom::bindings::codegen::UnionTypes::%s as %s;\n\n" %
|
||||||
(t.innerType, t.identifier.name))])
|
(t.innerType, t.identifier.name))])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
enum TestEnum { "", "foo", "bar" };
|
enum TestEnum { "", "foo", "bar" };
|
||||||
typedef (DOMString or URL or Blob) TestTypedef;
|
typedef (DOMString or URL or Blob) TestTypedef;
|
||||||
|
typedef (DOMString or URL or Blob)? TestTypedefNullableUnion;
|
||||||
|
|
||||||
dictionary TestDictionary {
|
dictionary TestDictionary {
|
||||||
required boolean requiredValue;
|
required boolean requiredValue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue