Bug 832094 - make the top-level function ParseNode always be a PNK_FUNCTION (r=jorendorff)

--HG--
extra : rebase_source : f6af6da88e185ccc62152ef1013dfeba1418cbc7
This commit is contained in:
Luke Wagner 2012-11-28 16:33:00 -08:00
parent eddfaf40ed
commit 9e1aa92b57
2 changed files with 4 additions and 1 deletions

View File

@ -275,11 +275,12 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
fun->setArgCount(formals.length());
/* FIXME: make Function format the source for a function definition. */
ParseNode *fn = FunctionNode::create(PNK_NAME, &parser);
ParseNode *fn = FunctionNode::create(PNK_FUNCTION, &parser);
if (!fn)
return false;
fn->pn_body = NULL;
fn->pn_funbox = NULL;
fn->pn_cookie.makeFree();
ParseNode *argsbody = ListNode::create(PNK_ARGSBODY, &parser);

View File

@ -712,6 +712,8 @@ Parser::standaloneFunctionBody(HandleFunction fun, const AutoNameVector &formals
if (!funbox)
return NULL;
fn->pn_funbox = *funbox;
ParseContext funpc(this, *funbox, 0, /* staticLevel = */ 0);
if (!funpc.init())
return NULL;