mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
reduce indentation in CodegenRust.py
We're going to wind up tacking on different pieces of code for the global vs. non-global case once we move the JS_SetReservedSlot call into create_dom_global. We might as well separate the indentation changes into a separate commit.
This commit is contained in:
parent
484c0e4546
commit
3d39646c8e
1 changed files with 22 additions and 20 deletions
|
@ -2157,27 +2157,29 @@ let obj = {
|
||||||
assert!(!obj.is_null());
|
assert!(!obj.is_null());
|
||||||
let obj = RootedObject::new(cx, obj);\
|
let obj = RootedObject::new(cx, obj);\
|
||||||
""" % (descriptor.name, parent)
|
""" % (descriptor.name, parent)
|
||||||
else:
|
elif descriptor.isGlobal():
|
||||||
if descriptor.isGlobal():
|
|
||||||
create += ("let obj = RootedObject::new(\n"
|
create += ("let obj = RootedObject::new(\n"
|
||||||
" cx,\n"
|
" cx,\n"
|
||||||
" create_dom_global(\n"
|
" create_dom_global(\n"
|
||||||
" cx,\n"
|
" cx,\n"
|
||||||
" &Class.base as *const js::jsapi::Class as *const JSClass,\n"
|
" &Class.base as *const js::jsapi::Class as *const JSClass,\n"
|
||||||
" Some(%s))\n"
|
" Some(%s))\n"
|
||||||
");\n" % TRACE_HOOK_NAME)
|
");\n"
|
||||||
|
"assert!(!obj.ptr.is_null());\n"
|
||||||
|
"\n"
|
||||||
|
"JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,\n"
|
||||||
|
" PrivateValue(raw as *const libc::c_void));" % TRACE_HOOK_NAME)
|
||||||
else:
|
else:
|
||||||
create += ("let obj = {\n"
|
create += ("let obj = {\n"
|
||||||
" let _ac = JSAutoCompartment::new(cx, proto.ptr);\n"
|
" let _ac = JSAutoCompartment::new(cx, proto.ptr);\n"
|
||||||
" JS_NewObjectWithGivenProto(\n"
|
" JS_NewObjectWithGivenProto(\n"
|
||||||
" cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle())\n"
|
" cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle())\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"let obj = RootedObject::new(cx, obj);\n")
|
"let obj = RootedObject::new(cx, obj);\n"
|
||||||
create += """\
|
"assert!(!obj.ptr.is_null());\n"
|
||||||
assert!(!obj.ptr.is_null());
|
"\n"
|
||||||
|
"JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,\n"
|
||||||
JS_SetReservedSlot(obj.ptr, DOM_OBJECT_SLOT,
|
" PrivateValue(raw as *const libc::c_void));")
|
||||||
PrivateValue(raw as *const libc::c_void));"""
|
|
||||||
return create
|
return create
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue