Fix TCF_RETURN_* flag propagation out of blocks (352197, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2006-09-11 21:29:00 +00:00
parent e3fe41e183
commit 0ab86235fe
2 changed files with 2 additions and 1 deletions

View File

@ -151,6 +151,7 @@ struct JSTreeContext { /* tree context for semantic checks */
#define TCF_IN_FUNCTION 0x02 /* parsing inside function body */
#define TCF_RETURN_EXPR 0x04 /* function has 'return expr;' */
#define TCF_RETURN_VOID 0x08 /* function has 'return;' */
#define TCF_RETURN_FLAGS 0x0C /* propagate these out of blocks */
#define TCF_IN_FOR_INIT 0x10 /* parsing init expr of for; exclude 'in' */
#define TCF_FUN_CLOSURE_VS_VAR 0x20 /* function and var with same name */
#define TCF_FUN_USES_NONLOCALS 0x40 /* function refers to non-local names */

View File

@ -3405,7 +3405,7 @@ Statement(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc)
(!tc->topStmt || tc->topStmt->type == STMT_BLOCK)) {
pn->pn_extra |= PNX_NEEDBRACES;
}
tc->flags = oldflags | (tc->flags & TCF_FUN_FLAGS);
tc->flags = oldflags | (tc->flags & (TCF_FUN_FLAGS | TCF_RETURN_FLAGS));
return pn;
}