aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/codegen
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-09-06 08:48:15 -0500
committerGitHub <noreply@github.com>2016-09-06 08:48:15 -0500
commit628c644feeb2ba72b17ec5d74e559223accabbf3 (patch)
tree19ed9a41b78adda50cd89ec576991666ebf67785 /components/script/dom/bindings/codegen
parent69b5a0d0d0b2869dd6f96cb71fea6135bb0e94fe (diff)
parenta60634b9986e2537c5fccdb0ff97b5a82d686c73 (diff)
downloadservo-628c644feeb2ba72b17ec5d74e559223accabbf3.tar.gz
servo-628c644feeb2ba72b17ec5d74e559223accabbf3.zip
Auto merge of #13183 - nox:cleanup-interface, r=Ms2ger
Clean up stuff in bindings::interface <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13183) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r--components/script/dom/bindings/codegen/CodegenRust.py32
1 files changed, 14 insertions, 18 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py
index 78748cea869..cb7e796c627 100644
--- a/components/script/dom/bindings/codegen/CodegenRust.py
+++ b/components/script/dom/bindings/codegen/CodegenRust.py
@@ -1136,20 +1136,20 @@ def instantiateJSToNativeConversionTemplate(templateBody, replacements,
def convertConstIDLValueToJSVal(value):
if isinstance(value, IDLNullValue):
- return "NullVal"
+ return "ConstantVal::NullVal"
tag = value.type.tag()
if tag in [IDLType.Tags.int8, IDLType.Tags.uint8, IDLType.Tags.int16,
IDLType.Tags.uint16, IDLType.Tags.int32]:
- return "IntVal(%s)" % (value.value)
+ return "ConstantVal::IntVal(%s)" % (value.value)
if tag == IDLType.Tags.uint32:
- return "UintVal(%s)" % (value.value)
+ return "ConstantVal::UintVal(%s)" % (value.value)
if tag in [IDLType.Tags.int64, IDLType.Tags.uint64]:
- return "DoubleVal(%s)" % (value.value)
+ return "ConstantVal::DoubleVal(%s)" % (value.value)
if tag == IDLType.Tags.bool:
- return "BoolVal(true)" if value.value else "BoolVal(false)"
+ return "ConstantVal::BoolVal(true)" if value.value else "ConstantVal::BoolVal(false)"
if tag in [IDLType.Tags.unrestricted_float, IDLType.Tags.float,
IDLType.Tags.unrestricted_double, IDLType.Tags.double]:
- return "DoubleVal(%s)" % (value.value)
+ return "ConstantVal::DoubleVal(%s)" % (value.value)
raise TypeError("Const value of unhandled type: " + value.type)
@@ -2072,12 +2072,9 @@ class CGInterfaceObjectJSClass(CGThing):
"depth": self.descriptor.prototypeDepth
}
return """\
-static INTERFACE_OBJECT_OPS: js::jsapi::ClassOps =
- NonCallbackInterfaceObjectClass::ops(%(constructorBehavior)s);
-
-static InterfaceObjectClass: NonCallbackInterfaceObjectClass =
+static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
- &INTERFACE_OBJECT_OPS,
+ &%(constructorBehavior)s,
%(representation)s,
PrototypeList::ID::%(id)s,
%(depth)s);
@@ -2751,7 +2748,7 @@ rooted!(in(cx) let mut interface = ptr::null_mut());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
- &InterfaceObjectClass,
+ &INTERFACE_OBJECT_CLASS,
%(static_methods)s,
%(static_attrs)s,
%(consts)s,
@@ -2820,13 +2817,13 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
constructors = self.descriptor.interface.namedConstructors
if constructors:
- decl = "let named_constructors: [(NonNullJSNative, &'static [u8], u32); %d]" % len(constructors)
+ decl = "let named_constructors: [(ConstructorClassHook, &'static [u8], u32); %d]" % len(constructors)
specs = []
for constructor in constructors:
hook = CONSTRUCT_HOOK_NAME + "_" + constructor.identifier.name
name = str_to_const_array(constructor.identifier.name)
length = methodLength(constructor)
- specs.append(CGGeneric("(%s as NonNullJSNative, %s, %d)" % (hook, name, length)))
+ specs.append(CGGeneric("(%s as ConstructorClassHook, %s, %d)" % (hook, name, length)))
values = CGIndenter(CGList(specs, "\n"), 4)
code.append(CGWrapper(values, pre="%s = [\n" % decl, post="\n];"))
code.append(CGGeneric("create_named_constructors(cx, global, &named_constructors, prototype.handle());"))
@@ -5432,15 +5429,14 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'dom',
'dom::bindings',
'dom::bindings::codegen::InterfaceObjectMap',
+ 'dom::bindings::constant::ConstantSpec',
+ 'dom::bindings::constant::ConstantVal',
'dom::bindings::global::GlobalRef',
'dom::bindings::global::global_root_from_object',
'dom::bindings::global::global_root_from_reflector',
- 'dom::bindings::interface::ConstantSpec',
- 'dom::bindings::interface::ConstantVal::IntVal',
- 'dom::bindings::interface::ConstantVal::UintVal',
+ 'dom::bindings::interface::ConstructorClassHook',
'dom::bindings::interface::InterfaceConstructorBehavior',
'dom::bindings::interface::NonCallbackInterfaceObjectClass',
- 'dom::bindings::interface::NonNullJSNative',
'dom::bindings::interface::create_callback_interface_object',
'dom::bindings::interface::create_global_object',
'dom::bindings::interface::create_interface_prototype_object',