Bug 494954 - JS_GetScriptLineExtent() does not returns the right value (r=mrbkap).
authorBrendan Eich <brendan@mozilla.org>
Wed, 27 May 2009 18:53:22 -0700
changeset 28816 e7a08f46b514cd7fc74fe09107f94ae4e144f314
parent 28815 b07ebbc4784e22123e5c1d0fbfb18a07a5efdb57
child 28817 26f38f9b8f493b1c381d6c89763a531a493f82cd
push id7273
push userrsayre@mozilla.com
push dateThu, 28 May 2009 22:52:43 +0000
treeherdermozilla-central@ac3e487c5fff [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs494954
milestone1.9.2a1pre
Bug 494954 - JS_GetScriptLineExtent() does not returns the right value (r=mrbkap).
js/src/jsparse.cpp
--- a/js/src/jsparse.cpp
+++ b/js/src/jsparse.cpp
@@ -1505,16 +1505,17 @@ JSCompiler::compileFunctionBody(JSContex
             pn = NULL;
         } else if (funcg.functionList &&
                    !jsc.analyzeFunctions(funcg.functionList, funcg.flags)) {
             pn = NULL;
         } else {
             if (fn->pn_body) {
                 JS_ASSERT(PN_TYPE(fn->pn_body) == TOK_ARGSBODY);
                 fn->pn_body->append(pn);
+                fn->pn_body->pn_pos = pn->pn_pos;
                 pn = fn->pn_body;
             }
 
             if (!js_EmitFunctionScript(cx, &funcg, pn))
                 pn = NULL;
         }
     }
 
@@ -2775,20 +2776,22 @@ FunctionDef(JSContext *cx, JSTokenStream
     } else {
         op = JSOP_NOP;
     }
 
     funbox->kids = funtc.functionList;
 
     pn->pn_funbox = funbox;
     pn->pn_op = op;
-    if (pn->pn_body)
+    if (pn->pn_body) {
         pn->pn_body->append(body);
-    else
+        pn->pn_body->pn_pos = body->pn_pos;
+    } else {
         pn->pn_body = body;
+    }
 
     pn->pn_blockid = tc->blockid();
 
     if (!LeaveFunction(pn, &funtc, tc, funAtom, lambda))
         return NULL;
 
     return result;
 }