mirror of
https://github.com/servo/servo.git
synced 2025-06-16 12:24:29 +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
|
@staticmethod
|
||||||
def PrototypeList(config):
|
def PrototypeList(config):
|
||||||
|
|
||||||
# Prototype ID enum.
|
# Prototype ID enum.
|
||||||
protos = [d.name for d in config.getDescriptors(hasInterfacePrototypeObject=True)]
|
protos = [d.name for d in config.getDescriptors(hasInterfacePrototypeObject=True)]
|
||||||
|
|
||||||
idEnum = CGNamespacedEnum('id', 'ID', protos, [0], deriving="Eq")
|
return CGList([
|
||||||
idEnum = CGList([idEnum])
|
CGGeneric(AUTOGENERATED_WARNING_COMMENT),
|
||||||
idEnum.append(CGGeneric(declare="pub static MAX_PROTO_CHAIN_LENGTH: uint = " +
|
CGGeneric("pub static MAX_PROTO_CHAIN_LENGTH: uint = %d;\n\n" % config.maxProtoChainLength),
|
||||||
str(config.maxProtoChainLength) + ";\n\n"))
|
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
|
@staticmethod
|
||||||
def RegisterBindings(config):
|
def RegisterBindings(config):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue