mirror of
https://github.com/servo/servo.git
synced 2025-06-17 04:44:28 +00:00
Cleanup the code in PrototypeList().
This commit is contained in:
parent
f7a847c581
commit
c97408969e
1 changed files with 5 additions and 43 deletions
|
@ -5976,53 +5976,15 @@ class GlobalGenRoots():
|
|||
|
||||
@staticmethod
|
||||
def PrototypeList(config):
|
||||
|
||||
# Prototype ID enum.
|
||||
protos = [d.name for d in config.getDescriptors(hasInterfacePrototypeObject=True)]
|
||||
|
||||
idEnum = CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq")
|
||||
idEnum = CGList([idEnum])
|
||||
idEnum.append(CGGeneric(declare="pub static MAX_PROTO_CHAIN_LENGTH: uint = " +
|
||||
str(config.maxProtoChainLength) + ";\n\n"))
|
||||
return CGList([
|
||||
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||
CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq"),
|
||||
])
|
||||
|
||||
# Wrap all of that in our namespaces.
|
||||
#idEnum = CGNamespace.build(['mozilla', 'dom', 'prototypes'],
|
||||
# CGWrapper(idEnum, pre='\n'))
|
||||
#idEnum = CGWrapper(idEnum, post='\n')
|
||||
|
||||
curr = CGList([idEnum])
|
||||
|
||||
# Constructor ID enum.
|
||||
constructors = [d.name for d in config.getDescriptors(hasInterfaceObject=True,
|
||||
hasInterfacePrototypeObject=False)]
|
||||
idEnum = CGNamespacedEnum('id', 'ID', constructors, [0])
|
||||
|
||||
# Wrap all of that in our namespaces.
|
||||
idEnum = CGNamespace.build(['mozilla', 'dom', 'constructors'],
|
||||
CGWrapper(idEnum, pre='\n'))
|
||||
idEnum = CGWrapper(idEnum, post='\n')
|
||||
|
||||
#XXXjdm Not sure what to do with the constructors right now
|
||||
#curr.append(idEnum)
|
||||
|
||||
#traitsDecl = CGGeneric(declare="""
|
||||
#template <prototypes::ID PrototypeID>
|
||||
#struct PrototypeTraits;
|
||||
#
|
||||
#template <class ConcreteClass>
|
||||
#struct PrototypeIDMap;
|
||||
#""")
|
||||
|
||||
#traitsDecl = CGNamespace.build(['mozilla', 'dom'],
|
||||
# CGWrapper(traitsDecl, post='\n'))
|
||||
|
||||
#curr.append(traitsDecl)
|
||||
|
||||
# Add the auto-generated comment.
|
||||
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)
|
||||
|
||||
# Done.
|
||||
return curr
|
||||
|
||||
@staticmethod
|
||||
def RegisterBindings(config):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue