diff options
author | Prabhjyot Singh Sodhi <prabhyotsingh95@gmail.com> | 2016-01-26 21:53:28 +0530 |
---|---|---|
committer | Prabhjyot Singh Sodhi <prabhyotsingh95@gmail.com> | 2016-01-26 21:56:44 +0530 |
commit | d6df844ae532b45905ed616118d0d70903c0b84d (patch) | |
tree | 89e76080890aaf49f5535fc803e20c123307289f /components/script/dom/bindings/codegen/CodegenRust.py | |
parent | 525e77f64fc65ea2397b4ff3849f5b1f39386698 (diff) | |
download | servo-d6df844ae532b45905ed616118d0d70903c0b84d.tar.gz servo-d6df844ae532b45905ed616118d0d70903c0b84d.zip |
generate typedefs in CodegenRust
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 84d80124df9..90939017ef9 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -5283,6 +5283,7 @@ class CGBindingRoot(CGThing): isCallback=True) enums = config.getEnums(webIDLFile) + typedefs = config.getTypedefs(webIDLFile) if not (descriptors or dictionaries or mainCallbacks or callbackDescriptors or enums): self.root = None @@ -5291,6 +5292,17 @@ class CGBindingRoot(CGThing): # Do codegen for all the enums. cgthings = [CGEnum(e) for e in enums] + # Do codegen for all the typdefs + for t in typedefs: + if t.innerType.isUnion(): + cgthings.extend([CGGeneric("\npub type %s = %s;\n\n" % (t.identifier.name, + "UnionTypes::" + str(t.innerType)))]) + else: + assert not typeNeedsRooting(t.innerType, config.getDescriptorProvider) + cgthings.extend([CGGeneric("\npub type %s = " % (t.identifier.name)), + getRetvalDeclarationForType(t.innerType, config.getDescriptorProvider()), + CGGeneric(";\n\n")]) + # Do codegen for all the dictionaries. cgthings.extend([CGDictionary(d, config.getDescriptorProvider()) for d in dictionaries]) |