Update SRC_LABELBRACE selection logic to be block-scope aware (352402, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2006-09-12 22:09:12 +00:00
parent 871991f5d3
commit 9fd6ba01ff

View File

@ -5088,7 +5088,8 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
return JS_FALSE;
pn2 = pn->pn_expr;
noteIndex = js_NewSrcNote2(cx, cg,
(pn2->pn_type == TOK_LC)
(pn2->pn_type == TOK_LC ||
pn2->pn_type == TOK_LEXICALSCOPE)
? SRC_LABELBRACE
: SRC_LABEL,
(ptrdiff_t) ALE_INDEX(ale));
@ -5107,7 +5108,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) {
if (pn2->pn_type == TOK_LC || pn2->pn_type == TOK_LEXICALSCOPE) {
if (js_NewSrcNote(cx, cg, SRC_ENDBRACE) < 0 ||
js_Emit1(cx, cg, JSOP_NOP) < 0) {
return JS_FALSE;