Bug 832094 - make the top-level function ParseNode always be a PNK_FUNCTION (r=jorendorff)
authorLuke Wagner <luke@mozilla.com>
Wed, 28 Nov 2012 16:33:00 -0800
changeset 119334 2674257f6117e3d03c67aa02a3ca84a7720ded40
parent 119333 5bd1808505507f64cdcf29cdd564f701c91e876d
child 119335 ba89f86986680a1ad8fdbca44a250ddb2fb9cc5b
push id21615
push userlwagner@mozilla.com
push dateSat, 19 Jan 2013 01:31:32 +0000
treeherdermozilla-inbound@2674257f6117 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs832094
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 832094 - make the top-level function ParseNode always be a PNK_FUNCTION (r=jorendorff)
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/Parser.cpp
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -270,21 +270,22 @@ frontend::CompileFunctionBody(JSContext 
         return false;
     parser.sct = &sct;
 
     JS_ASSERT(fun);
 
     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);
     if (!argsbody)
         return false;
     argsbody->setOp(JSOP_NOP);
     argsbody->makeEmpty();
     fn->pn_body = argsbody;
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -707,16 +707,18 @@ Parser::standaloneFunctionBody(HandleFun
 {
     if (becameStrict)
         *becameStrict = false;
 
     *funbox = newFunctionBox(fun, /* outerpc = */ NULL, strict);
     if (!funbox)
         return NULL;
 
+    fn->pn_funbox = *funbox;
+
     ParseContext funpc(this, *funbox, 0, /* staticLevel = */ 0);
     if (!funpc.init())
         return NULL;
 
     for (unsigned i = 0; i < formals.length(); i++) {
         if (!DefineArg(this, fn, formals[i]))
             return NULL;
     }