Bug 492150 - Unexpected error occurred when japascript.options.strict is true (r=mrbkap).

This commit is contained in:
Brendan Eich 2009-05-10 12:52:03 -07:00
parent d7dc2e67bf
commit c244179e84

View File

@ -3049,18 +3049,18 @@ BindVarOrConst(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc)
return JS_FALSE;
}
} else {
if (JS_HAS_STRICT_OPTION(cx)
? op != JSOP_DEFVAR || dn_kind != JSDefinition::VAR
: op == JSOP_DEFCONST ||
bool error = (op == JSOP_DEFCONST ||
dn_kind == JSDefinition::CONST ||
(dn_kind == JSDefinition::LET &&
(stmt->type != STMT_CATCH || OuterLet(tc, stmt, atom)))) {
(stmt->type != STMT_CATCH || OuterLet(tc, stmt, atom))));
if (JS_HAS_STRICT_OPTION(cx)
? op != JSOP_DEFVAR || dn_kind != JSDefinition::VAR
: error) {
name = js_AtomToPrintableString(cx, atom);
if (!name ||
!js_ReportCompileErrorNumber(cx, TS(tc->compiler), pn,
(op != JSOP_DEFCONST &&
dn_kind != JSDefinition::CONST &&
dn_kind != JSDefinition::LET)
!error
? JSREPORT_WARNING | JSREPORT_STRICT
: JSREPORT_ERROR,
JSMSG_REDECLARED_VAR,