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,54 +2007,54 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||||
return CGAbstractMethod.define(self)
|
return CGAbstractMethod.define(self)
|
||||||
|
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
body = ""
|
body = CGList([])
|
||||||
#XXXjdm This self.descriptor.concrete check shouldn't be necessary
|
#XXXjdm This self.descriptor.concrete check shouldn't be necessary
|
||||||
if not self.descriptor.concrete or self.descriptor.proxy:
|
if not self.descriptor.concrete or self.descriptor.proxy:
|
||||||
body += """ let traps = ProxyTraps {
|
body.append(CGGeneric("""let traps = ProxyTraps {
|
||||||
getPropertyDescriptor: Some(getPropertyDescriptor),
|
getPropertyDescriptor: Some(getPropertyDescriptor),
|
||||||
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
||||||
defineProperty: Some(defineProperty),
|
defineProperty: Some(defineProperty),
|
||||||
getOwnPropertyNames: ptr::null(),
|
getOwnPropertyNames: ptr::null(),
|
||||||
delete_: None,
|
delete_: None,
|
||||||
enumerate: ptr::null(),
|
enumerate: ptr::null(),
|
||||||
|
|
||||||
has: None,
|
has: None,
|
||||||
hasOwn: Some(hasOwn),
|
hasOwn: Some(hasOwn),
|
||||||
get: Some(get),
|
get: Some(get),
|
||||||
set: None,
|
set: None,
|
||||||
keys: ptr::null(),
|
keys: ptr::null(),
|
||||||
iterate: None,
|
iterate: None,
|
||||||
|
|
||||||
call: None,
|
call: None,
|
||||||
construct: None,
|
construct: None,
|
||||||
nativeCall: ptr::null(),
|
nativeCall: ptr::null(),
|
||||||
hasInstance: None,
|
hasInstance: None,
|
||||||
typeOf: None,
|
typeOf: None,
|
||||||
objectClassIs: None,
|
objectClassIs: None,
|
||||||
obj_toString: Some(obj_toString),
|
obj_toString: Some(obj_toString),
|
||||||
fun_toString: None,
|
fun_toString: None,
|
||||||
//regexp_toShared: ptr::null(),
|
//regexp_toShared: ptr::null(),
|
||||||
defaultValue: None,
|
defaultValue: None,
|
||||||
iteratorNext: None,
|
iteratorNext: None,
|
||||||
finalize: Some(%s),
|
finalize: Some(%s),
|
||||||
getElementIfPresent: None,
|
getElementIfPresent: None,
|
||||||
getPrototypeOf: None,
|
getPrototypeOf: None,
|
||||||
trace: Some(%s)
|
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 *_));
|
CreateProxyHandler(&traps, &Class as *_ as *_));
|
||||||
|
|
||||||
""" % (FINALIZE_HOOK_NAME,
|
""" % (FINALIZE_HOOK_NAME,
|
||||||
TRACE_HOOK_NAME,
|
TRACE_HOOK_NAME,
|
||||||
self.descriptor.name)
|
self.descriptor.name)))
|
||||||
|
|
||||||
if self.descriptor.interface.hasInterfaceObject():
|
if self.descriptor.interface.hasInterfaceObject():
|
||||||
body += """ let cx = (**js_info.js_context).ptr;
|
body.append(CGGeneric("""let cx = (**js_info.js_context).ptr;
|
||||||
let global = window.reflector().get_jsobject();
|
let global = window.reflector().get_jsobject();
|
||||||
assert!(global.is_not_null());
|
assert!(global.is_not_null());
|
||||||
assert!(GetProtoObject(cx, global, global).is_not_null());"""
|
assert!(GetProtoObject(cx, global, global).is_not_null());"""))
|
||||||
|
|
||||||
return CGGeneric(body)
|
return CGIndenter(body)
|
||||||
|
|
||||||
def needCx(returnType, arguments, extendedAttributes, considerTypes):
|
def needCx(returnType, arguments, extendedAttributes, considerTypes):
|
||||||
return (considerTypes and
|
return (considerTypes and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue