From 93dd592cdacc2d4b0e04e8fb900102242b3a2c82 Mon Sep 17 00:00:00 2001 From: "brendan%mozilla.org" Date: Wed, 13 Sep 2006 07:02:58 +0000 Subject: [PATCH] Fix labeled brace source annotation harder (352415, r=mrbkap). --- js/src/jsemit.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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;