mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use CGIndenter for CGDefineDOMInterfaceMethod.definition_body.
This commit is contained in:
parent
b717fbe868
commit
fa7a0aae75
1 changed files with 38 additions and 38 deletions
|
@ -2007,10 +2007,10 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
return CGAbstractMethod.define(self)
|
||||
|
||||
def definition_body(self):
|
||||
body = ""
|
||||
body = CGList([])
|
||||
#XXXjdm This self.descriptor.concrete check shouldn't be necessary
|
||||
if not self.descriptor.concrete or self.descriptor.proxy:
|
||||
body += """ let traps = ProxyTraps {
|
||||
body.append(CGGeneric("""let traps = ProxyTraps {
|
||||
getPropertyDescriptor: Some(getPropertyDescriptor),
|
||||
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
||||
defineProperty: Some(defineProperty),
|
||||
|
@ -2040,21 +2040,21 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
getElementIfPresent: None,
|
||||
getPrototypeOf: None,
|
||||
trace: Some(%s)
|
||||
};
|
||||
js_info.dom_static.proxy_handlers.insert(PrototypeList::id::%s as uint,
|
||||
};
|
||||
js_info.dom_static.proxy_handlers.insert(PrototypeList::id::%s as uint,
|
||||
CreateProxyHandler(&traps, &Class as *_ as *_));
|
||||
|
||||
""" % (FINALIZE_HOOK_NAME,
|
||||
TRACE_HOOK_NAME,
|
||||
self.descriptor.name)
|
||||
self.descriptor.name)))
|
||||
|
||||
if self.descriptor.interface.hasInterfaceObject():
|
||||
body += """ let cx = (**js_info.js_context).ptr;
|
||||
let global = window.reflector().get_jsobject();
|
||||
assert!(global.is_not_null());
|
||||
assert!(GetProtoObject(cx, global, global).is_not_null());"""
|
||||
body.append(CGGeneric("""let cx = (**js_info.js_context).ptr;
|
||||
let global = window.reflector().get_jsobject();
|
||||
assert!(global.is_not_null());
|
||||
assert!(GetProtoObject(cx, global, global).is_not_null());"""))
|
||||
|
||||
return CGGeneric(body)
|
||||
return CGIndenter(body)
|
||||
|
||||
def needCx(returnType, arguments, extendedAttributes, considerTypes):
|
||||
return (considerTypes and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue