Bug 754181 - Don't store the strict mode code flag twice (attempt 2). r=jwalden,luke.

This commit is contained in:
Nicholas Nethercote
2012-05-21 20:06:43 -07:00
parent 1523aeb76f
commit 9e96de5143
8 changed files with 81 additions and 82 deletions

View File

@@ -124,13 +124,8 @@ frontend::CompileScript(JSContext *cx, JSObject *scopeChain, StackFrame *callerF
return NULL;
/* If this is a direct call to eval, inherit the caller's strictness. */
if (callerFrame &&
callerFrame->isScriptFrame() &&
callerFrame->script()->strictModeCode)
{
if (callerFrame && callerFrame->isScriptFrame() && callerFrame->script()->strictModeCode)
bce.sc->setInStrictMode();
parser.tokenStream.setStrictMode();
}
#ifdef DEBUG
bool savedCallerFun;
@@ -271,8 +266,6 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
if (!parser.init())
return false;
TokenStream &tokenStream = parser.tokenStream;
SharedContext funsc(cx, /* inFunction = */ true);
TreeContext funtc(&parser, &funsc);
@@ -323,7 +316,7 @@ frontend::CompileFunctionBody(JSContext *cx, JSFunction *fun,
*/
ParseNode *pn = fn ? parser.functionBody(Parser::StatementListBody) : NULL;
if (pn) {
if (!tokenStream.matchToken(TOK_EOF)) {
if (!parser.tokenStream.matchToken(TOK_EOF)) {
parser.reportErrorNumber(NULL, JSREPORT_ERROR, JSMSG_SYNTAX_ERROR);
pn = NULL;
} else if (!FoldConstants(cx, pn, &parser)) {