swc/ecmascript/minifier/tests/terser/compress/reduce_vars/modified/output.terser.js
강동윤 ef6a745599
feat(es/minifier): Implement more rules (#1735)
swc_ecma_minifier:
 - Implement `evaluate` partially.
 - Store 'expected output' from terser along with our result.

swc_ecma_transforms_base:
 - `fixer`: Don't wrap `+ (a % b)`.

swc_ecma_transforms_optimization:
 - `expr_simplifier`: Preserve this in calls.
2021-05-25 16:39:07 +09:00

43 lines
704 B
JavaScript

function f0() {
var b = 2;
b++;
console.log(2);
console.log(4);
}
function f1() {
var b = 2;
--b;
console.log(2);
console.log(2);
}
function f2() {
3;
console.log(4);
console.log(6);
console.log(4);
console.log(7);
}
function f3() {
var b = 2;
b *= 3;
console.log(7);
console.log(9);
console.log(4);
console.log(10);
}
function f4() {
var b = 2,
c = 3;
b = c;
console.log(1 + b);
console.log(b + c);
console.log(1 + c);
console.log(1 + b + c);
}
function f5(a) {
B = a;
console.log(typeof A ? "yes" : "no");
console.log(typeof B ? "yes" : "no");
}
f0(), f1(), f2(), f3(), f4(), f5();