Bug 1018628 - Lookup definition node for identifierName in default value in destructuring. r=jorendorff

This commit is contained in:
Tooru Fujisawa 2015-02-19 03:15:31 +09:00
parent 2d6158780c
commit f8f59ee89e
2 changed files with 13 additions and 0 deletions

View File

@ -6292,7 +6292,10 @@ Parser<ParseHandler>::assignExpr(InvokedPrediction invoked)
if (!checkAndMarkAsAssignmentLhs(lhs, flavor)) if (!checkAndMarkAsAssignmentLhs(lhs, flavor))
return null(); return null();
bool saved = pc->inDeclDestructuring;
pc->inDeclDestructuring = false;
Node rhs = assignExpr(); Node rhs = assignExpr();
pc->inDeclDestructuring = saved;
if (!rhs) if (!rhs)
return null(); return null();

View File

@ -0,0 +1,10 @@
var a = 10;
function f1(a,
[b=(assertEq(a, 1), a=2, 42)],
{c:c=(assertEq(a, 2), a=3, 43)}) {
assertEq(a, 3);
assertEq(b, 42);
assertEq(c, 43);
}
f1(1, [], {});
assertEq(a, 10);