mirror of
https://github.com/servo/servo.git
synced 2025-06-09 17:13:24 +00:00
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.
This commit is contained in:
parent
c51879767e
commit
844d48e0af
1 changed files with 2 additions and 26 deletions
|
@ -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',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue