mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 765055: bind rest argument when defaults are present, r=jorendorff
This commit is contained in:
parent
b2e556276b
commit
bf38e76273
@ -5921,6 +5921,8 @@ frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
CheckTypeSet(cx, bce, JSOP_REST);
|
||||
if (Emit1(cx, bce, JSOP_UNDEFINED) < 0)
|
||||
return false;
|
||||
if (!BindNameToSlot(cx, bce, rest))
|
||||
return JS_FALSE;
|
||||
if (!EmitVarOp(cx, rest, JSOP_SETARG, bce))
|
||||
return false;
|
||||
if (Emit1(cx, bce, JSOP_POP) < 0)
|
||||
|
@ -17,3 +17,8 @@ function f3(a=rest, ...rest) {
|
||||
assertEqArray(rest, [2, 3, 4]);
|
||||
}
|
||||
f3(1, 2, 3, 4);
|
||||
function f4(a=42, ...f) {
|
||||
assertEq(typeof f, "function");
|
||||
function f() {}
|
||||
}
|
||||
f4()
|
||||
|
Loading…
Reference in New Issue
Block a user