Skip to content

Commit

Permalink
Various fixes to CodegenRust.py
Browse files Browse the repository at this point in the history
  • Loading branch information
brunoabinader committed Nov 4, 2014
1 parent 39960f3 commit 315f626
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -3611,7 +3611,7 @@ def getBody(self):
"}\n")

if indexedSetter or self.descriptor.operations['NamedSetter']:
setOrIndexedGet += "if set != 0 {\n"
setOrIndexedGet += "if set {\n"
if indexedSetter:
setOrIndexedGet += (" if index.is_some() {\n" +
" let index = index.unwrap();\n")
Expand All @@ -3622,7 +3622,7 @@ def getBody(self):
" return true;\n" +
" }\n")
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:
# FIXME need to check that this is a 'supported property name'
assert False
Expand Down Expand Up @@ -3683,7 +3683,7 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
def __init__(self, descriptor):
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
Argument('jsid', 'id'),
Argument('*const JSPropertyDescriptor', 'desc')]
Argument('*mut JSPropertyDescriptor', 'desc')]
CGAbstractExternMethod.__init__(self, descriptor, "defineProperty", "bool", args)
self.descriptor = descriptor
def getBody(self):
Expand Down Expand Up @@ -3720,7 +3720,7 @@ def getBody(self):
CGIndenter(CGProxyNamedSetter(self.descriptor)).define() + "\n" +
"}\n")
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 this = UnwrapProxy(proxy);\n" +
" let this = JS::from_raw(this);\n" +
Expand Down Expand Up @@ -4177,6 +4177,7 @@ def __init__(self, descriptor):
cgThings.append(CGDOMJSProxyHandler_obj_toString(descriptor))
cgThings.append(CGDOMJSProxyHandler_get(descriptor))
cgThings.append(CGDOMJSProxyHandler_hasOwn(descriptor))

if descriptor.operations['IndexedSetter'] or descriptor.operations['NamedSetter']:
cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor))

Expand Down

5 comments on commit 315f626

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging brunoabinader/servo/dataset = 315f626 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brunoabinader/servo/dataset = 315f626 merged ok, testing candidate = c4cfb4a

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = c4cfb4a

Please sign in to comment.