Bug 795625 - Don't push StmtInfo for Parser::functionBody; r=jorendorff on irc

This commit is contained in:
Eddy Bruel 2012-10-02 16:04:25 +02:00
parent ff53cbaba5
commit 335dd478e2
3 changed files with 3 additions and 15 deletions

View File

@ -22,7 +22,7 @@ ParseContext::blockid()
inline bool
ParseContext::atBodyLevel()
{
return !topStmt || topStmt->isFunctionBodyBlock;
return !topStmt;
}
inline

View File

@ -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.

View File

@ -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<JSAtom *> FuncStmtSet;