Bug 823310 - Only report strict warnings when JSOPTION_STRICT is set. r=njn,jorendorff

This commit is contained in:
Benjamin Peterson 2012-12-21 11:02:06 -06:00
parent eaecff5d2f
commit 9e26bef53b
5 changed files with 12 additions and 8 deletions

View File

@ -1718,7 +1718,7 @@ BytecodeEmitter::reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
bool result = tokenStream()->reportStrictWarningErrorNumberVA(pn, sc->strict, errorNumber, args);
bool result = tokenStream()->reportStrictWarningErrorNumberVA(pn, errorNumber, args);
va_end(args);
return result;
}

View File

@ -518,8 +518,7 @@ Parser::reportStrictWarning(ParseNode *pn, unsigned errorNumber, ...)
{
va_list args;
va_start(args, errorNumber);
bool result = tokenStream.reportStrictWarningErrorNumberVA(pn, pc->sc->strict,
errorNumber, args);
bool result = tokenStream.reportStrictWarningErrorNumberVA(pn, errorNumber, args);
va_end(args);
return result;
}

View File

@ -612,10 +612,9 @@ TokenStream::reportWarning(unsigned errorNumber, ...)
}
bool
TokenStream::reportStrictWarningErrorNumberVA(ParseNode *pn, bool strictMode, unsigned errorNumber,
va_list args)
TokenStream::reportStrictWarningErrorNumberVA(ParseNode *pn, unsigned errorNumber, va_list args)
{
if (!strictMode && !cx->hasStrictOption())
if (!cx->hasStrictOption())
return true;
return reportCompileErrorNumberVA(NULL, JSREPORT_STRICT | JSREPORT_WARNING, errorNumber, args);

View File

@ -541,8 +541,7 @@ class TokenStream
va_list args);
bool reportStrictModeErrorNumberVA(ParseNode *pn, bool strictMode, unsigned errorNumber,
va_list args);
bool reportStrictWarningErrorNumberVA(ParseNode *pn, bool strictMode, unsigned errorNumber,
va_list args);
bool reportStrictWarningErrorNumberVA(ParseNode *pn, unsigned errorNumber, va_list args);
private:
// These are private because they should only be called by the tokenizer

View File

@ -0,0 +1,7 @@
"use strict";
options("werror");
// This construct causes a strict warning, but we shouldn't get one since
// JSOPTION_STRICT isn't enabled.
var x;
eval("if (x = 3) {}");