- This brings in the flow test suite that contains a ton of JavaScript parsing edge cases - This creates snapshot tests using the pretty printer for all of them - If uncomment `RUN_AST_TESTS` line in `tests/run_specs.js`, it checks ast(pretty_print(x)) == ast(x). Right now, "178 failed, 197 passed, 375 of 377 total". So half of the tests are not passing, most of them are crashes and many of the rest are subtle issues.
43 lines
752 B
JavaScript
43 lines
752 B
JavaScript
function foo(x: boolean) {
|
|
var arr = [1, 2, 3];
|
|
for (var elem of arr) {
|
|
if (x) {
|
|
continue;
|
|
}
|
|
return;
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|
|
|
|
function bar(x: boolean) {
|
|
for (var elem of []) {
|
|
return;
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|
|
|
|
function baz(x: boolean) {
|
|
for (var elem of []) {
|
|
continue;
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|
|
|
|
function bliffl(x: boolean) {
|
|
var arr = [1, 2, 3];
|
|
loop1: for (var elem of arr) {
|
|
loop2: for (var elem of arr) {
|
|
break loop1;
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|
|
|
|
function corge(x: boolean) {
|
|
for (var elem of []) {
|
|
break;
|
|
}
|
|
console.log('this is still reachable');
|
|
}
|