fix for if (...) return; else return ...;

(it was assumed that the first `return` always contains a value)

close #22
This commit is contained in:
Mihai Bazon
2012-10-24 09:33:32 +03:00
parent 30faaf13ed
commit 70fd2b1f33
2 changed files with 19 additions and 2 deletions

17
test/compress/issue-22.js Normal file
View File

@@ -0,0 +1,17 @@
return_with_no_value_in_if_body: {
options = { conditionals: true };
input: {
function foo(bar) {
if (bar) {
return;
} else {
return 1;
}
}
}
expect: {
function foo (bar) {
return bar ? void 0 : 1;
}
}
}