зеркало из https://github.com/mozilla/pjs.git
bug 108257, "source notes broken for functions compiled via JS_CompileUCFunctionForPrincipals", sr=brendan, r=shaver
no need to emit the function body after calling FunctionBody
This commit is contained in:
Родитель
359881f527
Коммит
c05a36c659
|
@ -1750,6 +1750,7 @@ js_EmitFunctionBody(JSContext *cx, JSCodeGenerator *cg, JSParseNode *body,
|
|||
* whichever consumes less space. \
|
||||
*/ \
|
||||
if (_delta >= (uintN)(2 + ((_line > SN_3BYTE_OFFSET_MASK)<<1))) { \
|
||||
JS_ASSERT(_line != 0); \
|
||||
if (js_NewSrcNote2(cx, cg, SRC_SETLINE, (ptrdiff_t)_line) < 0)\
|
||||
return JS_FALSE; \
|
||||
} else { \
|
||||
|
|
|
@ -603,8 +603,18 @@ js_CompileFunctionBody(JSContext *cx, JSTokenStream *ts, JSFunction *fun)
|
|||
if (!pn) {
|
||||
ok = JS_FALSE;
|
||||
} else {
|
||||
ok = js_FoldConstants(cx, pn, &funcg.treeContext) &&
|
||||
js_EmitFunctionBody(cx, &funcg, pn, fun);
|
||||
/*
|
||||
* No need to emit code here -- Statements (via FunctionBody) already
|
||||
* has. See similar comment in js_CompileTokenStream, and bug 108257.
|
||||
*/
|
||||
fun->script = js_NewScriptFromCG(cx, &funcg, fun);
|
||||
if (!fun->script) {
|
||||
ok = JS_FALSE;
|
||||
} else {
|
||||
if (funcg.treeContext.flags & TCF_FUN_HEAVYWEIGHT)
|
||||
fun->flags |= JSFUN_HEAVYWEIGHT;
|
||||
ok = JS_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Restore saved state and release code generation arenas. */
|
||||
|
|
Загрузка…
Ссылка в новой задаче