mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 1255167 - Default destructuring arguments should show up as lexical dependencies; r=jorendorff
--HG-- extra : rebase_source : 88d9870638eb5565410a5acc23c19f119e56a117
This commit is contained in:
parent
a2e846edaf
commit
25742678cc
@ -9352,7 +9352,12 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
|
||||
return null();
|
||||
|
||||
tokenStream.consumeKnownToken(TOK_ASSIGN);
|
||||
bool saved = pc->inDeclDestructuring;
|
||||
// Setting `inDeclDestructuring` to false allows name use to be noted
|
||||
// in `identifierName` See Bug: 1255167.
|
||||
pc->inDeclDestructuring = false;
|
||||
Node rhs = assignExpr(InAllowed, yieldHandling, TripledotProhibited);
|
||||
pc->inDeclDestructuring = saved;
|
||||
if (!rhs)
|
||||
return null();
|
||||
|
||||
|
@ -123,5 +123,14 @@ assertEq((({a = 0} = {}) => a)({a: 1}), 1);
|
||||
assertEq(j, 2);
|
||||
}
|
||||
|
||||
// Default destructuring values, which are variables, should be defined
|
||||
// within closures (Bug 1255167).
|
||||
{
|
||||
let f = function(a){
|
||||
return (function({aa = a}){ return aa; })({});
|
||||
};
|
||||
assertEq(f(9999), 9999);
|
||||
}
|
||||
|
||||
if (typeof reportCompare == "function")
|
||||
reportCompare(true, true);
|
||||
|
Loading…
Reference in New Issue
Block a user