Don't emit JSOP_DEF{VAR,CONST} unless at top-level or in a heavyweight function (146596, r=jband, sr=shaver).

git-svn-id: svn://10.0.0.236/trunk@122176 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org 2002-05-26 00:33:23 +00:00
parent 89f0cee255
commit ce6cc88b16

View File

@ -3083,10 +3083,13 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
return JS_FALSE;
atomIndex = ALE_INDEX(ale);
/* Emit a prolog bytecode to predefine the variable. */
CG_SWITCH_TO_PROLOG(cg);
EMIT_ATOM_INDEX_OP(pn->pn_op, atomIndex);
CG_SWITCH_TO_MAIN(cg);
if (!(cg->treeContext.flags & TCF_IN_FUNCTION) ||
(cg->treeContext.flags & TCF_FUN_HEAVYWEIGHT)) {
/* Emit a prolog bytecode to predefine the variable. */
CG_SWITCH_TO_PROLOG(cg);
EMIT_ATOM_INDEX_OP(pn->pn_op, atomIndex);
CG_SWITCH_TO_MAIN(cg);
}
}
if (pn2->pn_expr) {
if (op == JSOP_SETNAME)