Fix 349489, a=schrep.

git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@208220 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org
2006-08-23 19:41:21 +00:00
parent 8ab59d1289
commit 6e708eac09

View File

@@ -4754,7 +4754,17 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
if (!CheckSideEffects(cx, &cg->treeContext, pn2, &useful))
return JS_FALSE;
}
if (!useful) {
/*
* Don't eliminate apparently useless expressions if they are
* labeled expression statements. The tc->topStmt->update test
* catches the case where we are nesting in js_EmitTree for a
* labeled compound statement.
*/
if (!useful &&
(!cg->treeContext.topStmt ||
cg->treeContext.topStmt->type != STMT_LABEL ||
cg->treeContext.topStmt->update < CG_OFFSET(cg))) {
CG_CURRENT_LINE(cg) = pn2->pn_pos.begin.lineno;
if (!js_ReportCompileErrorNumber(cx, cg,
JSREPORT_CG |