mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Merge the Wrap and Wrap_ functions in codegen.
This commit is contained in:
parent
4a6077ca4c
commit
12380edc63
1 changed files with 2 additions and 14 deletions
|
@ -2596,12 +2596,12 @@ def CreateBindingJSObject(descriptor, parent=None):
|
|||
"""
|
||||
return create
|
||||
|
||||
class CGWrapWithCacheMethod(CGAbstractMethod):
|
||||
class CGWrapMethod(CGAbstractMethod):
|
||||
def __init__(self, descriptor):
|
||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
||||
args = [Argument('*JSContext', 'aCx'), Argument('*JSObject', 'aScope'),
|
||||
Argument(DOMObjectPointerArg(descriptor), 'aObject', mutable=True)]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap_', '*JSObject', args)
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', '*JSObject', args, pub=True)
|
||||
|
||||
def definition_body(self):
|
||||
if not self.descriptor.createGlobal:
|
||||
|
@ -2630,17 +2630,6 @@ class CGWrapWithCacheMethod(CGAbstractMethod):
|
|||
(*raw).mut_reflector().set_jsobject(obj);
|
||||
return obj;""" % CreateBindingJSObject(self.descriptor)
|
||||
|
||||
class CGWrapMethod(CGAbstractMethod):
|
||||
def __init__(self, descriptor):
|
||||
# XXX can we wrap if we don't have an interface prototype object?
|
||||
assert descriptor.interface.hasInterfacePrototypeObject()
|
||||
args = [Argument('*JSContext', 'aCx'), Argument('*JSObject', 'aScope'),
|
||||
Argument(DOMObjectPointerArg(descriptor), 'aObject', mutable=True)]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'Wrap', '*JSObject', args, inline=True, pub=True)
|
||||
|
||||
def definition_body(self):
|
||||
return "return Wrap_(aCx, aScope, aObject);"
|
||||
|
||||
class CGAbstractExternMethod(CGAbstractMethod):
|
||||
"""
|
||||
Abstract base class for codegen of implementation-only (no
|
||||
|
@ -4937,7 +4926,6 @@ class CGDescriptor(CGThing):
|
|||
cgThings.append(CGDOMJSClass(descriptor))
|
||||
pass
|
||||
|
||||
cgThings.append(CGWrapWithCacheMethod(descriptor))
|
||||
cgThings.append(CGWrapMethod(descriptor))
|
||||
|
||||
cgThings = CGList((CGIndenter(t, declareOnly=True) for t in cgThings), "\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue