diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-04-29 21:33:27 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-04-29 21:33:27 +0200 |
commit | 844d48e0af1f6a6cce17f9825a8eb8be83547ba5 (patch) | |
tree | a67398835e46ae6813dc78c58fc9324c28b1dbf3 /src | |
parent | c51879767e81aecc75d2efceaa72ce5a9a78b172 (diff) | |
download | servo-844d48e0af1f6a6cce17f9825a8eb8be83547ba5.tar.gz servo-844d48e0af1f6a6cce17f9825a8eb8be83547ba5.zip |
Merge UnionConversions() into UnionTypes().
It's not very useful to have one but not the other, so it makes more sense
to deal with them together.
Diffstat (limited to 'src')
-rw-r--r-- | src/components/script/dom/bindings/codegen/CodegenRust.py | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index c15230725d2..a455b7d0b16 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -1669,30 +1669,10 @@ def UnionTypes(descriptors): if t.isUnion(): name = str(t) if not name in unionStructs: - unionStructs[name] = CGUnionStruct(t, d) + unionStructs[name] = CGList([CGUnionStruct(t, d), CGUnionConversionStruct(t, d)]) - return CGList(SortedDictValues(unionStructs), "\n") + return CGList(SortedDictValues(unionStructs), "\n\n") -def UnionConversions(descriptors): - """ - Returns a CGThing to declare all union argument conversion helper structs. - """ - # Now find all the things we'll need as arguments because we - # need to unwrap them. - unionConversions = dict() - for d in descriptors: - def addUnionTypes(type): - if type.isUnion(): - type = type.unroll() - name = str(type) - if not name in unionConversions: - unionConversions[name] = CGUnionConversionStruct(type, d) - - for t in getTypes(d): - addUnionTypes(t) - - return CGWrapper(CGList(SortedDictValues(unionConversions), "\n"), - post="\n\n") class Argument(): """ @@ -5320,10 +5300,6 @@ class GlobalGenRoots(): curr = UnionTypes(config.getDescriptors()) - curr = CGWrapper(curr, post='\n') - - curr = CGList([curr, UnionConversions(config.getDescriptors())], "\n") - curr = CGImports(curr, [ 'dom::bindings::utils::unwrap_jsmanaged', 'dom::bindings::codegen::PrototypeList', |