Bug 1051760 - Fix "Assertion failure: !vp.isMagic(), at jsobj.cpp:4600" with arguments, direct eval, and a destructuring declaration. r=Waldo.

--HG--
extra : rebase_source : 8054e6ed982d32e2a8e2d91cf52093abe589bfd2
This commit is contained in:
Jason Orendorff 2014-09-11 17:57:29 -05:00
parent c5d1bccdd2
commit d801cfb035
2 changed files with 13 additions and 0 deletions

View File

@ -7329,9 +7329,18 @@ typename ParseHandler::Node
Parser<ParseHandler>::computedPropertyName(Node literal)
{
uint32_t begin = pos().begin;
// Turn off the inDeclDestructuring flag when parsing computed property
// names. In short, when parsing 'let {[x + y]: z} = obj;', noteNameUse()
// should be called on x and y, but not on z. See the comment on
// Parser<>::checkDestructuring() for details.
bool saved = pc->inDeclDestructuring;
pc->inDeclDestructuring = false;
Node assignNode = assignExpr();
pc->inDeclDestructuring = saved;
if (!assignNode)
return null();
MUST_MATCH_TOKEN(TOK_RB, JSMSG_COMP_PROP_UNTERM_EXPR);
Node propname = handler.newComputedName(assignNode, begin, pos().end);
if (!propname)

View File

@ -0,0 +1,4 @@
function test() {
eval("var { [arguments] : y } = {};");
}
test();