aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-07-11 03:59:57 +0100
committerGitHub <noreply@github.com>2021-07-11 10:59:57 +0800
commit08391b8e1c35da8b094aa4eebe6e6b6bbf5f3019 (patch)
tree59b2c7ef1f67a407e1564efc2c89559f026d126a /test
parentd147d5d7f0bc61b1284a18a31eaa41c208a278ea (diff)
downloadtracifyjs-08391b8e1c35da8b094aa4eebe6e6b6bbf5f3019.tar.gz
tracifyjs-08391b8e1c35da8b094aa4eebe6e6b6bbf5f3019.zip
fix corner case in `hoist_props` (#5069)
Diffstat (limited to 'test')
-rw-r--r--test/compress/hoist_props.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/compress/hoist_props.js b/test/compress/hoist_props.js
index 597db4bc..2b4abff1 100644
--- a/test/compress/hoist_props.js
+++ b/test/compress/hoist_props.js
@@ -786,6 +786,32 @@ issue_3071_1: {
reduce_vars: true,
sequences: true,
side_effects: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ var obj = {};
+ obj.one = 1;
+ obj.two = 2;
+ console.log(obj.one, obj.two);
+ })();
+ }
+ expect: {
+ console.log(1, 2);
+ }
+ expect_stdout: "1 2"
+}
+
+issue_3071_1_toplevel: {
+ options = {
+ evaluate: true,
+ hoist_props: true,
+ inline: true,
+ join_vars: true,
+ passes: 3,
+ reduce_vars: true,
+ sequences: true,
+ side_effects: true,
toplevel: true,
unused: true,
}
@@ -1094,3 +1120,24 @@ object_super: {
expect_stdout: "PASS"
node_version: ">=4"
}
+
+issue_4985: {
+ options = {
+ hoist_props: true,
+ reduce_vars: true,
+ toplevel: true,
+ }
+ input: {
+ var a = { p: 42 };
+ console.log(function() {
+ a;
+ }());
+ }
+ expect: {
+ var a_p = 42;
+ console.log(function() {
+ ({});
+ }());
+ }
+ expect_stdout: "undefined"
+}