From c97408969e2bd3a96e326498e43e96457d5ed7a1 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Tue, 11 Mar 2014 12:45:43 +0100 Subject: [PATCH] Cleanup the code in PrototypeList(). --- .../dom/bindings/codegen/CodegenRust.py | 48 ++----------------- 1 file changed, 5 insertions(+), 43 deletions(-) diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py index 9701023b12d..459609bceec 100644 --- a/src/components/script/dom/bindings/codegen/CodegenRust.py +++ b/src/components/script/dom/bindings/codegen/CodegenRust.py @@ -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 -#struct PrototypeTraits; -# -#template -#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):