mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Various fixes to CodegenRust.py
This commit is contained in:
parent
39960f32e4
commit
315f626393
1 changed files with 5 additions and 4 deletions
|
@ -3611,7 +3611,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
|
||||||
"}\n")
|
"}\n")
|
||||||
|
|
||||||
if indexedSetter or self.descriptor.operations['NamedSetter']:
|
if indexedSetter or self.descriptor.operations['NamedSetter']:
|
||||||
setOrIndexedGet += "if set != 0 {\n"
|
setOrIndexedGet += "if set {\n"
|
||||||
if indexedSetter:
|
if indexedSetter:
|
||||||
setOrIndexedGet += (" if index.is_some() {\n" +
|
setOrIndexedGet += (" if index.is_some() {\n" +
|
||||||
" let index = index.unwrap();\n")
|
" let index = index.unwrap();\n")
|
||||||
|
@ -3622,7 +3622,7 @@ class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
|
||||||
" return true;\n" +
|
" return true;\n" +
|
||||||
" }\n")
|
" }\n")
|
||||||
if self.descriptor.operations['NamedSetter']:
|
if self.descriptor.operations['NamedSetter']:
|
||||||
setOrIndexedGet += " if RUST_JSID_IS_STRING(id) {\n"
|
setOrIndexedGet += " if RUST_JSID_IS_STRING(id) != 0 {\n"
|
||||||
if not 'NamedCreator' in self.descriptor.operations:
|
if not 'NamedCreator' in self.descriptor.operations:
|
||||||
# FIXME need to check that this is a 'supported property name'
|
# FIXME need to check that this is a 'supported property name'
|
||||||
assert False
|
assert False
|
||||||
|
@ -3683,7 +3683,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
|
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
|
||||||
Argument('jsid', 'id'),
|
Argument('jsid', 'id'),
|
||||||
Argument('*const JSPropertyDescriptor', 'desc')]
|
Argument('*mut JSPropertyDescriptor', 'desc')]
|
||||||
CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "bool", args)
|
CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "bool", args)
|
||||||
self.descriptor = descriptor
|
self.descriptor = descriptor
|
||||||
def getBody(self):
|
def getBody(self):
|
||||||
|
@ -3720,7 +3720,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() + "\n" +
|
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() + "\n" +
|
||||||
"}\n")
|
"}\n")
|
||||||
elif self.descriptor.operations['NamedGetter']:
|
elif self.descriptor.operations['NamedGetter']:
|
||||||
set += ("if RUST_JSID_IS_STRING(id) {\n" +
|
set += ("if RUST_JSID_IS_STRING(id) != 0 {\n" +
|
||||||
" let name = jsid_to_str(cx, id);\n" +
|
" let name = jsid_to_str(cx, id);\n" +
|
||||||
" let this = UnwrapProxy(proxy);\n" +
|
" let this = UnwrapProxy(proxy);\n" +
|
||||||
" let this = JS::from_raw(this);\n" +
|
" let this = JS::from_raw(this);\n" +
|
||||||
|
@ -4177,6 +4177,7 @@ class CGDescriptor(CGThing):
|
||||||
cgThings.append(CGDOMJSProxyHandler_obj_toString(descriptor))
|
cgThings.append(CGDOMJSProxyHandler_obj_toString(descriptor))
|
||||||
cgThings.append(CGDOMJSProxyHandler_get(descriptor))
|
cgThings.append(CGDOMJSProxyHandler_get(descriptor))
|
||||||
cgThings.append(CGDOMJSProxyHandler_hasOwn(descriptor))
|
cgThings.append(CGDOMJSProxyHandler_hasOwn(descriptor))
|
||||||
|
|
||||||
if descriptor.operations['IndexedSetter'] or descriptor.operations['NamedSetter']:
|
if descriptor.operations['IndexedSetter'] or descriptor.operations['NamedSetter']:
|
||||||
cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor))
|
cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue