aboutsummaryrefslogtreecommitdiff
path: root/test/compress/drop-unused.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-11-05 06:18:45 +0800
committerGitHub <noreply@github.com>2017-11-05 06:18:45 +0800
commit5b4b07e9a7d67e593c6ae8d54dc77d174afd25ac (patch)
tree160e150e66c8f05da4d8d35097777ac5c4595b4f /test/compress/drop-unused.js
parenta8aa28a7a6c0cb415965d055119956d4333de8fa (diff)
downloadtracifyjs-5b4b07e9a7d67e593c6ae8d54dc77d174afd25ac.tar.gz
tracifyjs-5b4b07e9a7d67e593c6ae8d54dc77d174afd25ac.zip
extend function inlining safety checks (#2430)
Diffstat (limited to 'test/compress/drop-unused.js')
-rw-r--r--test/compress/drop-unused.js55
1 files changed, 44 insertions, 11 deletions
diff --git a/test/compress/drop-unused.js b/test/compress/drop-unused.js
index 4ce8d2eb..af6a7a47 100644
--- a/test/compress/drop-unused.js
+++ b/test/compress/drop-unused.js
@@ -1109,11 +1109,11 @@ var_catch_toplevel: {
}
}
-issue_2105: {
+issue_2105_1: {
options = {
collapse_vars: true,
inline: true,
- passes: 3,
+ passes: 2,
reduce_vars: true,
side_effects: true,
unused: true,
@@ -1139,17 +1139,50 @@ issue_2105: {
});
}
expect: {
- (function() {
- var quux = function() {
+ ({
+ prop: function() {
+ console.log;
console.log("PASS");
- };
- return {
- prop: function() {
- console.log;
- quux();
+ }
+ }).prop();
+ }
+ expect_stdout: "PASS"
+}
+
+issue_2105_2: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ passes: 2,
+ properties: true,
+ pure_getters: "strict",
+ reduce_vars: true,
+ side_effects: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ !function(factory) {
+ factory();
+ }( function() {
+ return function(fn) {
+ fn()().prop();
+ }( function() {
+ function bar() {
+ var quux = function() {
+ console.log("PASS");
+ }, foo = function() {
+ console.log;
+ quux();
+ };
+ return { prop: foo };
}
- };
- })().prop();
+ return bar;
+ } );
+ });
+ }
+ expect: {
+ console.log("PASS");
}
expect_stdout: "PASS"
}