diff --git a/js/src/frontend/Parser-inl.h b/js/src/frontend/Parser-inl.h index d85b92303d9..632d44e2474 100644 --- a/js/src/frontend/Parser-inl.h +++ b/js/src/frontend/Parser-inl.h @@ -22,7 +22,7 @@ ParseContext::blockid() inline bool ParseContext::atBodyLevel() { - return !topStmt || topStmt->isFunctionBodyBlock; + return !topStmt; } inline diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 717926c5625..e3dc542718f 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -114,7 +114,6 @@ PushStatementPC(ParseContext *pc, StmtInfoPC *stmt, StmtType type) { stmt->blockid = pc->blockid(); PushStatement(pc, stmt, type); - stmt->isFunctionBodyBlock = false; } // See comment on member function declaration. @@ -711,11 +710,6 @@ ParseNode * Parser::functionBody(FunctionBodyType type) { JS_ASSERT(pc->sc->isFunction); - - StmtInfoPC stmtInfo(context); - PushStatementPC(pc, &stmtInfo, STMT_BLOCK); - stmtInfo.isFunctionBodyBlock = true; - JS_ASSERT(!pc->funHasReturnExpr && !pc->funHasReturnVoid); ParseNode *pn; @@ -751,9 +745,6 @@ Parser::functionBody(FunctionBodyType type) if (!pn) return NULL; - JS_ASSERT(!pc->topStmt->isBlockScope); - FinishPopStatement(pc); - /* Check for falling off the end of a function that returns a value. */ if (context->hasStrictOption() && pc->funHasReturnExpr && !CheckFinalReturn(context, this, pn)) @@ -3584,7 +3575,7 @@ Parser::letStatement() if (stmt && stmt->isBlockScope) { JS_ASSERT(pc->blockChain == stmt->blockObj); } else { - if (!stmt || stmt->isFunctionBodyBlock) { + if (pc->atBodyLevel()) { /* * ES4 specifies that let at top level and at body-block scope * does not shadow var, so convert back to var. diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index f0d8962e81c..e4b6b20bb84 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -31,10 +31,7 @@ struct StmtInfoPC : public StmtInfoBase { uint32_t blockid; /* for simplified dominance computation */ - /* True if type == STMT_BLOCK and this block is a function body. */ - bool isFunctionBodyBlock; - - StmtInfoPC(JSContext *cx) : StmtInfoBase(cx), isFunctionBodyBlock(false) {} + StmtInfoPC(JSContext *cx) : StmtInfoBase(cx) {} }; typedef HashSet FuncStmtSet;