UglifyJS/test/compress/typeof.js
alexlamsl 7413899ad4 minor tweak to sequence manipulations
- loop through `AST_Seq` chain instead of recursion
- avoid deep-cloning in `lift_sequences()`
- `AST_Seq.car` should never be `null` or `AST_Seq`
- `AST_Seq.cdr` should never be `null`
2017-02-02 01:30:19 +08:00

48 lines
1.1 KiB
JavaScript

typeof_evaluation: {
options = {
evaluate: true
};
input: {
a = typeof 1;
b = typeof 'test';
c = typeof [];
d = typeof {};
e = typeof /./;
f = typeof false;
g = typeof function(){};
h = typeof undefined;
}
expect: {
a='number';
b='string';
c=typeof[];
d=typeof{};
e=typeof/./;
f='boolean';
g='function';
h='undefined';
}
}
typeof_in_boolean_context: {
options = {
booleans : true,
evaluate : true,
conditionals : true,
sequences : true,
};
input: {
function f1(x) { return typeof x ? "yes" : "no"; }
function f2() { return typeof g()? "Yes" : "No"; }
typeof 0 ? foo() : bar();
!typeof console.log(1);
var a = !typeof console.log(2);
}
expect: {
function f1(x) { return "yes"; }
function f2() { return g(), "Yes"; }
foo(), console.log(1), !1;
var a = (console.log(2), !1);
}
}