aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-06-20 17:50:40 +0200
committerMs2ger <ms2ger@gmail.com>2014-06-20 18:47:31 +0200
commit5acbea51999ead858aa90266a5ab4473a3dd11da (patch)
tree4db5ca12ebd95c4adddbd3ae2a6754cab98cb46f /src/components/script/dom/bindings/codegen
parentf11e7ee0a9f0d0181ce5efa809ccff888d1ff06a (diff)
downloadservo-5acbea51999ead858aa90266a5ab4473a3dd11da.tar.gz
servo-5acbea51999ead858aa90266a5ab4473a3dd11da.zip
Pass the interface object-related arguments to CreateInterfaceObjects2 together in an Option.
This clarifies the code and fixes our support of NoInterfaceObject interfaces.
Diffstat (limited to 'src/components/script/dom/bindings/codegen')
-rw-r--r--src/components/script/dom/bindings/codegen/CodegenRust.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/components/script/dom/bindings/codegen/CodegenRust.py b/src/components/script/dom/bindings/codegen/CodegenRust.py
index 3155ab2f025..647fd50766f 100644
--- a/src/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/src/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1880,13 +1880,6 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
getParentProto = ("let parentProto: *mut JSObject = %s;\n"
"assert!(parentProto.is_not_null());\n") % getParentProto
- if self.descriptor.interface.ctor():
- constructHook = CONSTRUCT_HOOK_NAME
- constructArgs = methodLength(self.descriptor.interface.ctor())
- else:
- constructHook = "ThrowingConstructor"
- constructArgs = 0
-
if self.descriptor.concrete:
if self.descriptor.proxy:
domClass = "&Class"
@@ -1901,20 +1894,31 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
return "None"
return "Some(%s.as_slice())" % val
+ if needInterfaceObject:
+ if self.descriptor.interface.ctor():
+ constructHook = CONSTRUCT_HOOK_NAME
+ constructArgs = methodLength(self.descriptor.interface.ctor())
+ else:
+ constructHook = "ThrowingConstructor"
+ constructArgs = 0
+
+ constructor = 'Some((%s, "%s", %d))' % (
+ constructHook, self.descriptor.interface.identifier.name,
+ constructArgs)
+ else:
+ constructor = 'None'
+
call = """return CreateInterfaceObjects2(aCx, aGlobal, aReceiver, parentProto,
- &PrototypeClass, %s, %d,
- %s,
+ &PrototypeClass, %s,
%s,
%s,
%s,
%s,
%s);""" % (
- "Some(%s)" % constructHook if needInterfaceObject else "None",
- constructArgs,
+ constructor,
domClass,
arrayPtr("methods"), arrayPtr("attrs"),
- arrayPtr("consts"), arrayPtr("staticMethods"),
- '"' + self.descriptor.interface.identifier.name + '"' if needInterfaceObject else "ptr::null()")
+ arrayPtr("consts"), arrayPtr("staticMethods"))
functionBody = CGList(
[CGGeneric(getParentProto),