Fix off-by-one and logic bugs conspiring against catch blocks (339262, r=mrbkap).

This commit is contained in:
brendan%mozilla.org 2006-05-25 22:23:37 +00:00
Родитель 5cca6f02d5
Коммит 12e96a89cf
2 изменённых файлов: 6 добавлений и 3 удалений

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

@ -1516,8 +1516,11 @@ LexicalLookup(JSContext *cx, JSTreeContext *tc, JSAtom *atom, jsint *slotp)
for (stmt = tc->topScopeStmt; stmt; stmt = stmt->downScope) {
if (stmt->type == STMT_WITH)
return stmt;
if (stmt->type == STMT_CATCH && stmt->label == atom)
return stmt;
if (stmt->type == STMT_CATCH) {
if (stmt->label == atom)
return stmt;
continue;
}
JS_ASSERT(stmt->type == STMT_BLOCK_SCOPE);
obj = stmt->blockObj;

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

@ -79,7 +79,7 @@ typedef enum JSStmtType {
} JSStmtType;
#define STMT_TYPE_IS_SCOPE(type) \
((uintN)((type) - STMT_WITH) < (uintN)(STMT_CATCH - STMT_WITH))
((uintN)((type) - STMT_WITH) <= (uintN)(STMT_CATCH - STMT_WITH))
#define STMT_TYPE_IS_LOOP(type) ((type) >= STMT_DO_LOOP)
#define STMT_IS_SCOPE(stmt) STMT_TYPE_IS_SCOPE((stmt)->type)