Auto merge of #13333 - splav:JS-setters-fix#13327, r=jdm

fix JS IndexedGetter and NamedSetter bindings generation

<!-- Please describe your changes on the following line: -->
Fix JS IndexedGetter and NamedSetter bindings generation.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13327 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because the test will be in PR for #13129 as currently these setters are used by nobody.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13333)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-09-22 01:36:25 -05:00 committed by GitHub
commit 73b2963509

View file

@ -4842,13 +4842,12 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
" let this = UnwrapProxy(proxy);\n" +
" let this = &*this;\n" +
CGIndenter(CGProxyIndexedSetter(self.descriptor)).define() +
" return true;\n" +
" return (*opresult).succeed();\n" +
"}\n")
elif self.descriptor.operations['IndexedGetter']:
set += ("if get_array_index_from_id(cx, id).is_some() {\n" +
" return false;\n" +
" //return ThrowErrorMessage(cx, MSG_NO_PROPERTY_SETTER, \"%s\");\n" +
"}\n") % self.descriptor.name
" return (*opresult).failNoIndexedSetter();\n" +
"}\n")
namedSetter = self.descriptor.operations['NamedSetter']
if namedSetter:
@ -4864,15 +4863,10 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
else:
set += ("if RUST_JSID_IS_STRING(id) {\n" +
CGIndenter(CGProxyNamedGetter(self.descriptor)).define() +
" if (found) {\n"
# TODO(Issue 5876)
" //return js::IsInNonStrictPropertySet(cx)\n" +
" // ? opresult.succeed()\n" +
" // : ThrowErrorMessage(cx, MSG_NO_NAMED_SETTER, \"${name}\");\n" +
" return (*opresult).succeed();\n" +
" }\n" +
" return (*opresult).succeed();\n"
"}\n") % (self.descriptor.name, self.descriptor.name)
" if result.is_some() {\n"
" return (*opresult).failNoNamedSetter();\n"
" }\n"
"}\n")
set += "return proxyhandler::define_property(%s);" % ", ".join(a.name for a in self.args)
return set