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
Родитель 8f3d718c47
Коммит d2eca49e6b
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -2030,7 +2030,7 @@ JSCompiler::setFunctionKinds(JSFunctionBox *funbox, uint16& tcflags)
/*
* Watch out for code such as
*
*
* (function () {
* ...
* var jQuery = ... = function (...) {
@ -3049,18 +3049,18 @@ BindVarOrConst(JSContext *cx, BindData *data, JSAtom *atom, JSTreeContext *tc)
return JS_FALSE;
}
} else {
bool error = (op == JSOP_DEFCONST ||
dn_kind == JSDefinition::CONST ||
(dn_kind == JSDefinition::LET &&
(stmt->type != STMT_CATCH || OuterLet(tc, stmt, atom))));
if (JS_HAS_STRICT_OPTION(cx)
? op != JSOP_DEFVAR || dn_kind != JSDefinition::VAR
: op == JSOP_DEFCONST ||
dn_kind == JSDefinition::CONST ||
(dn_kind == JSDefinition::LET &&
(stmt->type != STMT_CATCH || OuterLet(tc, stmt, atom)))) {
: 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,