Don't move empty statement up from if (1); or if (0)foo();else; to statement level, in case a label prefixes the if -- change the if to a {} instead (350263, r=mrbkap/shaver).

This commit is contained in:
brendan%mozilla.org 2006-08-27 21:15:44 +00:00
Родитель 34e63bbbba
Коммит e3446f868c
1 изменённых файлов: 6 добавлений и 3 удалений

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

@ -6090,11 +6090,14 @@ js_FoldConstants(JSContext *cx, JSParseNode *pn, JSTreeContext *tc)
} else {
PN_MOVE_NODE(pn, pn2);
}
} else {
}
if (!pn2 || (pn->pn_type == TOK_SEMI && !pn->pn_kid)) {
/*
* False condition and no else: make pn an empty block (not an
* False condition and no else, or an empty then-statement was
* moved up over pn. Either way, make pn an empty block (not an
* empty statement, which does not decompile, even when labeled).
* NB: pn must be a TOK_IF as TOK_HOOK can never have a null kid.
* NB: pn must be a TOK_IF as TOK_HOOK can never have a null kid
* or an empty statement for a child.
*/
pn->pn_type = TOK_LC;
pn->pn_arity = PN_LIST;