diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/compress/hoist_vars.js | 78 | ||||
-rw-r--r-- | test/compress/pure_funcs.js | 12 | ||||
-rw-r--r-- | test/compress/templates.js | 2 |
3 files changed, 85 insertions, 7 deletions
diff --git a/test/compress/hoist_vars.js b/test/compress/hoist_vars.js index 4ca2ce5b..e3972b8a 100644 --- a/test/compress/hoist_vars.js +++ b/test/compress/hoist_vars.js @@ -295,3 +295,81 @@ issue_4859: { } expect_stdout: "Infinity" } + +issue_4893_1: { + options = { + collapse_vars: true, + evaluate: true, + hoist_vars: true, + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + function f() { + function g() {} + var a = null; + var b = null; + var c = null; + b.p += a = 42; + f; + } + try { + f(); + } catch (e) { + console.log("PASS"); + } + } + expect: { + try{ + (function f() { + var b; + b = null; + b.p += 42; + f; + })(); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" +} + +issue_4893_2: { + options = { + collapse_vars: true, + hoist_vars: true, + pure_getters: "strict", + reduce_vars: true, + side_effects: true, + toplevel: true, + unused: true, + } + input: { + function f() { + function g() {} + var a = null; + var b = null; + var c = null; + b.p += a = 42; + f; + } + try { + f(); + } catch (e) { + console.log("PASS"); + } + } + expect: { + try{ + (function() { + var b; + b = null; + b.p += 42; + })(); + } catch (e) { + console.log("PASS"); + } + } + expect_stdout: "PASS" +} diff --git a/test/compress/pure_funcs.js b/test/compress/pure_funcs.js index 98768423..bf38003c 100644 --- a/test/compress/pure_funcs.js +++ b/test/compress/pure_funcs.js @@ -133,7 +133,7 @@ conditional: { relational: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { foo() in new foo(); @@ -158,7 +158,7 @@ relational: { arithmetic: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { foo() + foo(); @@ -183,7 +183,7 @@ arithmetic: { boolean_and: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { foo() && foo(); @@ -208,7 +208,7 @@ boolean_and: { boolean_or: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { foo() || foo(); @@ -233,7 +233,7 @@ boolean_or: { assign: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { var a; @@ -256,7 +256,7 @@ assign: { unary: { options = { pure_funcs: [ "foo" ], - side_effects :true, + side_effects: true, } input: { typeof foo(); diff --git a/test/compress/templates.js b/test/compress/templates.js index a27c6b8b..e46f3c06 100644 --- a/test/compress/templates.js +++ b/test/compress/templates.js @@ -343,7 +343,7 @@ issue_4676: { reduce_vars: true, templates: true, toplevel: true, - unsafe:true, + unsafe: true, unused: true, } input: { |