mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use CGIndenter for CGClassConstructHook.definition_body.
This commit is contained in:
parent
31ab6415c9
commit
f3a8f74d3c
1 changed files with 7 additions and 10 deletions
|
@ -3772,17 +3772,14 @@ class CGClassConstructHook(CGAbstractExternMethod):
|
||||||
return CGAbstractExternMethod.define(self)
|
return CGAbstractExternMethod.define(self)
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return CGGeneric(self.generate_code())
|
preamble = CGGeneric("""
|
||||||
|
let global = global_object_for_js_object(JS_CALLEE(cx, vp).to_object()).root();
|
||||||
def generate_code(self):
|
let obj = global.deref().reflector().get_jsobject();
|
||||||
preamble = """
|
""")
|
||||||
let global = global_object_for_js_object(JS_CALLEE(cx, vp).to_object()).root();
|
|
||||||
let obj = global.deref().reflector().get_jsobject();
|
|
||||||
"""
|
|
||||||
nativeName = MakeNativeName(self._ctor.identifier.name)
|
nativeName = MakeNativeName(self._ctor.identifier.name)
|
||||||
callGenerator = CGIndenter(CGMethodCall(["&global.root_ref()"], nativeName, True,
|
callGenerator = CGMethodCall(["&global.root_ref()"], nativeName, True,
|
||||||
self.descriptor, self._ctor))
|
self.descriptor, self._ctor)
|
||||||
return preamble + callGenerator.define();
|
return CGIndenter(CGList([preamble, callGenerator]))
|
||||||
|
|
||||||
class CGClassFinalizeHook(CGAbstractClassHook):
|
class CGClassFinalizeHook(CGAbstractClassHook):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue