Fix labeled brace source annotation harder (352415, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2006-09-13 07:02:58 +00:00
Родитель 28d714c602
Коммит 93dd592cda
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -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;