Bug 780405 - Set the funbox kids in LeaveFunction, so generator expression boxes don't lose them. r=jorendorff

This commit is contained in:
Benjamin Peterson 2012-08-07 13:41:31 -07:00
parent 2f1dc96c4c
commit cb1e061ba7
2 changed files with 2 additions and 2 deletions

View File

@ -1097,6 +1097,7 @@ LeaveFunction(ParseNode *fn, Parser *parser, PropertyName *funName = NULL,
FunctionBox *funbox = fn->pn_funbox;
funbox->cxFlags = funtc->sc->cxFlags; // copy all the flags
funbox->kids = funtc->functionList;
if (!tc->topStmt || tc->topStmt->type == STMT_BLOCK)
fn->pn_dflags |= PND_BLOCKCHILD;
@ -1727,8 +1728,6 @@ Parser::functionDef(HandlePropertyName funName, FunctionType type, FunctionSynta
}
}
funbox->kids = funtc.functionList;
pn->pn_funbox = funbox;
pn->setOp(op);
pn->pn_body->append(body);

View File

@ -9,6 +9,7 @@ assertEq(f3()()(), true);
// These should be okay.
function f4(f=(function () { with (Object) {} }), g=(function () { "use strict"; })) {}
function f5(g=(function () { "use strict"; }), f=(function () { with (Object) {} })) {}
function f6(f=(function () { return (x for (y in (function g() {}))); })) {}
assertThrowsInstanceOf(function () {
eval("function f(a=delete x) { 'use strict'; }");