mirror of
https://github.com/servo/servo.git
synced 2025-06-12 18:34:39 +00:00
Use an enum to pass the index value for interfaces/protos.
This commit is contained in:
parent
747a99d3f6
commit
7d9dc458af
2 changed files with 27 additions and 9 deletions
|
@ -3490,11 +3490,12 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
|
|||
CGAbstractMethod.__init__(self, descriptor, name,
|
||||
'void', args, pub=pub)
|
||||
self.id = idPrefix + "::" + MakeNativeName(self.descriptor.name)
|
||||
self.variant = self.id.split('::')[-2]
|
||||
|
||||
def definition_body(self):
|
||||
return CGGeneric("""
|
||||
get_per_interface_object_handle(cx, global, %s as usize, CreateInterfaceObjects, rval)
|
||||
""" % self.id)
|
||||
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::%s(%s), CreateInterfaceObjects, rval)
|
||||
""" % (self.variant, self.id))
|
||||
|
||||
|
||||
class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
|
||||
|
@ -3647,14 +3648,15 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
else:
|
||||
idPrefix = "PrototypeList::ID"
|
||||
self.id = idPrefix + "::" + MakeNativeName(self.descriptor.name)
|
||||
self.variant = self.id.split('::')[-2]
|
||||
|
||||
def define(self):
|
||||
return CGAbstractMethod.define(self)
|
||||
|
||||
def definition_body(self):
|
||||
return CGGeneric("""
|
||||
define_dom_interface(cx, global, %s as usize, CreateInterfaceObjects, ConstructorEnabled)
|
||||
""" % self.id)
|
||||
define_dom_interface(cx, global, ProtoOrIfaceIndex::%s(%s), CreateInterfaceObjects, ConstructorEnabled)
|
||||
""" % (self.variant, self.id))
|
||||
|
||||
|
||||
def needCx(returnType, arguments, considerTypes):
|
||||
|
@ -6425,17 +6427,18 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
|
|||
'crate::dom::bindings::interface::ConstructorClassHook',
|
||||
'crate::dom::bindings::interface::InterfaceConstructorBehavior',
|
||||
'crate::dom::bindings::interface::NonCallbackInterfaceObjectClass',
|
||||
'crate::dom::bindings::interface::ProtoOrIfaceIndex',
|
||||
'crate::dom::bindings::interface::create_global_object',
|
||||
'crate::dom::bindings::interface::create_callback_interface_object',
|
||||
'crate::dom::bindings::interface::create_interface_prototype_object',
|
||||
'crate::dom::bindings::interface::create_named_constructors',
|
||||
'crate::dom::bindings::interface::create_noncallback_interface_object',
|
||||
'crate::dom::bindings::interface::define_dom_interface',
|
||||
'crate::dom::bindings::interface::define_guarded_constants',
|
||||
'crate::dom::bindings::interface::define_guarded_methods',
|
||||
'crate::dom::bindings::interface::define_guarded_properties',
|
||||
'crate::dom::bindings::interface::is_exposed_in',
|
||||
'crate::dom::bindings::interface::get_per_interface_object_handle',
|
||||
'crate::dom::bindings::interface::define_dom_interface',
|
||||
'crate::dom::bindings::htmlconstructor::pop_current_element_queue',
|
||||
'crate::dom::bindings::htmlconstructor::push_new_element_queue',
|
||||
'crate::dom::bindings::iterable::Iterable',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue