Bug 855088 - Watch for 'arguments' variables declared within 'with' blocks, r=luke.

This commit is contained in:
Brian Hackett 2013-04-11 16:19:10 -06:00
parent eb4321380d
commit 9e809c98e5
2 changed files with 19 additions and 2 deletions

View File

@ -2493,8 +2493,20 @@ Parser<FullParseHandler>::bindVarOrConst(JSContext *cx, BindData<FullParseHandle
if (stmt && stmt->type == STMT_WITH) {
pn->pn_dflags |= PND_DEOPTIMIZED;
if (pc->sc->isFunctionBox())
pc->sc->asFunctionBox()->setMightAliasLocals();
if (pc->sc->isFunctionBox()) {
FunctionBox *funbox = pc->sc->asFunctionBox();
funbox->setMightAliasLocals();
/*
* This definition isn't being added to the parse context's
* declarations, so make sure to indicate the need to deoptimize
* the script's arguments object.
*/
if (name == cx->names().arguments) {
funbox->setArgumentsHasLocalBinding();
funbox->setDefinitelyNeedsArgsObj();
}
}
return true;
}

View File

@ -0,0 +1,5 @@
(function (y) {
arguments.y = 2;
with (0) var arguments=5;
})(1);