aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-02-26 00:40:33 +0800
committerGitHub <noreply@github.com>2017-02-26 00:40:33 +0800
commit16cd5d57a5cf7f5750104df0e5af246708fd493f (patch)
treee9ea6b8432ce0bddeeeef317f96765de1467ceeb /test/compress
parent834f9f39245f1ddf5a29c579afd7ebcdb0afe585 (diff)
downloadtracifyjs-16cd5d57a5cf7f5750104df0e5af246708fd493f.tar.gz
tracifyjs-16cd5d57a5cf7f5750104df0e5af246708fd493f.zip
consolidate `evaluate` & `reduce_vars` (#1505)
- improve marking efficiency - apply smarter `const` replacement to `var` fixes #1501
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/evaluate.js2
-rw-r--r--test/compress/reduce_vars.js16
2 files changed, 9 insertions, 9 deletions
diff --git a/test/compress/evaluate.js b/test/compress/evaluate.js
index ae5e58d6..5cefadc8 100644
--- a/test/compress/evaluate.js
+++ b/test/compress/evaluate.js
@@ -615,7 +615,7 @@ call_args: {
const a = 1;
console.log(1);
+function(a) {
- return a;
+ return 1;
}(1);
}
}
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index d9d02efa..0ee201c0 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -134,8 +134,8 @@ modified: {
}
function f2() {
- var b = 2, c = 3;
- b = c;
+ var b = 2;
+ b = 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);
@@ -143,8 +143,8 @@ modified: {
}
function f3() {
- var b = 2, c = 3;
- b *= c;
+ var b = 2;
+ b *= 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);
@@ -236,7 +236,7 @@ unsafe_evaluate_object: {
function f0(){
var a = 1;
var b = {};
- b[a] = 2;
+ b[1] = 2;
console.log(4);
}
@@ -280,7 +280,7 @@ unsafe_evaluate_array: {
function f0(){
var a = 1;
var b = [];
- b[a] = 2;
+ b[1] = 2;
console.log(4);
}
@@ -373,8 +373,8 @@ passes: {
}
expect: {
function f() {
- var b = 2, c = 3;
- b = c;
+ var b = 2;
+ b = 3;
console.log(1 + b);
console.log(b + 3);
console.log(4);