always keep declarations found in unreachable code

a few more tests and some cleanups.
This commit is contained in:
Mihai Bazon
2012-09-07 15:18:32 +03:00
parent b77574ea1c
commit 919b2733ab
5 changed files with 226 additions and 49 deletions

View File

@@ -119,8 +119,10 @@ function parse_test(file) {
})
);
var stat = node.body;
if (stat instanceof U.AST_BlockStatement && stat.body.length == 1)
stat = stat.body[0];
if (stat instanceof U.AST_BlockStatement) {
if (stat.body.length == 1) stat = stat.body[0];
else if (stat.body.length == 0) stat = new U.AST_EmptyStatement();
}
test[node.label.name] = stat;
return true;
}