diff --git a/js/src/jsemit.h b/js/src/jsemit.h index 79c7bb898958..518224b3a692 100644 --- a/js/src/jsemit.h +++ b/js/src/jsemit.h @@ -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 */ diff --git a/js/src/jsparse.c b/js/src/jsparse.c index bfb782ef73d2..5fdb63a55548 100644 --- a/js/src/jsparse.c +++ b/js/src/jsparse.c @@ -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; }