diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-02-19 19:49:33 +0530 |
---|---|---|
committer | bors-servo <lbergstrom+bors@mozilla.com> | 2016-02-19 19:49:33 +0530 |
commit | 267630779316d2291b10ed8e60d0f9f5f2100ab1 (patch) | |
tree | 2a30ece64e0157517d3421642a021c4760a4a66b /components/script/dom/bindings/codegen | |
parent | aae6525f7d23e0a1b2af0e77e7c9a91402e1f9e7 (diff) | |
parent | bb9d3692c7eb38d515309fe13539946c9532d1fc (diff) | |
download | servo-267630779316d2291b10ed8e60d0f9f5f2100ab1.tar.gz servo-267630779316d2291b10ed8e60d0f9f5f2100ab1.zip |
Auto merge of #9633 - GuillaumeGomez:has_instance, r=nox
All interface objects now share the same hasInstance
r? @nox
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9633)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 53a2fd12987..cefb3b23e15 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -1892,13 +1892,14 @@ class CGInterfaceObjectJSClass(CGThing): constructor = "throwing_constructor" args = { "constructor": constructor, - "hasInstance": HASINSTANCE_HOOK_NAME, "name": self.descriptor.interface.identifier.name, + "id": self.descriptor.interface.identifier.name, + "depth": self.descriptor.prototypeDepth } return """\ static InterfaceObjectClass: NonCallbackInterfaceObjectClass = - NonCallbackInterfaceObjectClass::new(%(constructor)s, %(hasInstance)s, - fun_to_string); + NonCallbackInterfaceObjectClass::new(%(constructor)s, fun_to_string, + PrototypeList::ID::%(id)s, %(depth)s); """ % args @@ -4762,29 +4763,6 @@ let args = CallArgs::from_vp(vp, argc); return CGList([preamble, callGenerator]) -class CGClassHasInstanceHook(CGAbstractExternMethod): - def __init__(self, descriptor): - args = [Argument('*mut JSContext', 'cx'), - Argument('HandleObject', 'obj'), - Argument('MutableHandleValue', 'value'), - Argument('*mut bool', 'rval')] - assert descriptor.interface.hasInterfaceObject() and not descriptor.interface.isCallback() - CGAbstractExternMethod.__init__(self, descriptor, HASINSTANCE_HOOK_NAME, - 'bool', args) - - def definition_body(self): - id = "PrototypeList::ID::%s" % self.descriptor.interface.identifier.name - return CGGeneric("""\ -match has_instance(cx, obj, value.handle(), %(id)s, %(index)s) { - Ok(result) => { - *rval = result; - true - } - Err(()) => false, -} -""" % {"id": id, "index": self.descriptor.prototypeDepth}) - - class CGClassFunToStringHook(CGAbstractExternMethod): """ A hook to convert functions to strings. @@ -4967,7 +4945,6 @@ class CGDescriptor(CGThing): cgThings.append(CGClassConstructHook(descriptor, ctor)) if not descriptor.interface.isCallback(): cgThings.append(CGInterfaceObjectJSClass(descriptor)) - cgThings.append(CGClassHasInstanceHook(descriptor)) cgThings.append(CGClassFunToStringHook(descriptor)) if not descriptor.interface.isCallback(): @@ -5394,7 +5371,7 @@ class CGBindingRoot(CGThing): 'dom::bindings::global::{GlobalRef, global_root_from_object, global_root_from_reflector}', 'dom::bindings::interface::{NonCallbackInterfaceObjectClass, create_callback_interface_object}', 'dom::bindings::interface::{create_interface_prototype_object, create_named_constructors}', - 'dom::bindings::interface::{create_noncallback_interface_object, has_instance}', + 'dom::bindings::interface::{create_noncallback_interface_object}', 'dom::bindings::interface::{ConstantSpec, NonNullJSNative}', 'dom::bindings::interface::ConstantVal::{IntVal, UintVal}', 'dom::bindings::js::{JS, Root, RootedReference}', |