diff --git a/js/src/jsemit.c b/js/src/jsemit.c index 62420e51d627..169750ca4ba5 100644 --- a/js/src/jsemit.c +++ b/js/src/jsemit.c @@ -5087,11 +5087,12 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) if (!ale) return JS_FALSE; pn2 = pn->pn_expr; - noteIndex = js_NewSrcNote2(cx, cg, - (pn2->pn_type == TOK_LC || - pn2->pn_type == TOK_LEXICALSCOPE) - ? SRC_LABELBRACE - : SRC_LABEL, + noteType = (pn2->pn_type == TOK_LC || + (pn2->pn_type == TOK_LEXICALSCOPE && + pn2->pn_expr->pn_type == TOK_LC)) + ? SRC_LABELBRACE + : SRC_LABEL; + noteIndex = js_NewSrcNote2(cx, cg, noteType, (ptrdiff_t) ALE_INDEX(ale)); if (noteIndex < 0 || js_Emit1(cx, cg, JSOP_NOP) < 0) { @@ -5108,7 +5109,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) return JS_FALSE; /* If the statement was compound, emit a note for the end brace. */ - if (pn2->pn_type == TOK_LC || pn2->pn_type == TOK_LEXICALSCOPE) { + if (noteType == SRC_LABELBRACE) { if (js_NewSrcNote(cx, cg, SRC_ENDBRACE) < 0 || js_Emit1(cx, cg, JSOP_NOP) < 0) { return JS_FALSE;