2016-09-01 13:24:56 +00:00
|
|
|
string_plus_optimization: {
|
|
|
|
|
options = {
|
2018-07-01 06:34:42 +00:00
|
|
|
booleans: true,
|
|
|
|
|
comparisons: true,
|
|
|
|
|
conditionals: true,
|
|
|
|
|
dead_code: true,
|
|
|
|
|
evaluate: true,
|
|
|
|
|
hoist_funs: true,
|
|
|
|
|
if_return: true,
|
|
|
|
|
join_vars: true,
|
|
|
|
|
side_effects: true,
|
|
|
|
|
unused: true,
|
|
|
|
|
}
|
2016-09-01 13:24:56 +00:00
|
|
|
input: {
|
|
|
|
|
function foo(anything) {
|
|
|
|
|
function throwing_function() {
|
|
|
|
|
throw "nope";
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
console.log('0' + throwing_function() ? "yes" : "no");
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
console.log(ex);
|
|
|
|
|
}
|
|
|
|
|
console.log('0' + anything ? "yes" : "no");
|
|
|
|
|
console.log(anything + '0' ? "Yes" : "No");
|
|
|
|
|
console.log('' + anything);
|
|
|
|
|
console.log(anything + '');
|
|
|
|
|
}
|
|
|
|
|
foo();
|
|
|
|
|
}
|
|
|
|
|
expect: {
|
|
|
|
|
function foo(anything) {
|
|
|
|
|
function throwing_function() {
|
|
|
|
|
throw "nope";
|
|
|
|
|
}
|
|
|
|
|
try {
|
2017-02-27 18:25:44 +00:00
|
|
|
console.log((throwing_function(), "yes"));
|
2016-09-01 13:24:56 +00:00
|
|
|
} catch (ex) {
|
|
|
|
|
console.log(ex);
|
|
|
|
|
}
|
|
|
|
|
console.log("yes");
|
|
|
|
|
console.log("Yes");
|
|
|
|
|
console.log('' + anything);
|
|
|
|
|
console.log(anything + '');
|
|
|
|
|
}
|
|
|
|
|
foo();
|
|
|
|
|
}
|
2017-03-19 04:00:32 +00:00
|
|
|
expect_stdout: true
|
2016-09-01 13:24:56 +00:00
|
|
|
}
|