aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-19 16:02:25 +0000
committerGitHub <noreply@github.com>2020-11-20 00:02:25 +0800
commitb18b70f63bce53f1e19ad53c35cef6860b736ea6 (patch)
treef82121756a2ffc89e669d2a4176810f9e54b1ec9 /test/compress
parent641406d4910a8991cbd41b0814fedd5f38958850 (diff)
downloadtracifyjs-b18b70f63bce53f1e19ad53c35cef6860b736ea6.tar.gz
tracifyjs-b18b70f63bce53f1e19ad53c35cef6860b736ea6.zip
fix corner case in `hoist_props` (#4307)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/hoist_props.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/compress/hoist_props.js b/test/compress/hoist_props.js
index 09137cc9..dbee9b42 100644
--- a/test/compress/hoist_props.js
+++ b/test/compress/hoist_props.js
@@ -297,6 +297,33 @@ name_collision_3: {
expect_stdout: "true 4 6"
}
+name_collision_4: {
+ options = {
+ hoist_props: true,
+ reduce_vars: true,
+ }
+ input: {
+ console.log(function() {
+ var o = {
+ p: 0,
+ q: "PASS",
+ };
+ return function(o_p) {
+ if (!o.p) return o_p;
+ }(o.q);
+ }());
+ }
+ expect: {
+ console.log(function() {
+ var o_p$0 = 0, o_q = "PASS";
+ return function(o_p) {
+ if (!o_p$0) return o_p;
+ }(o_q);
+ }());
+ }
+ expect_stdout: "PASS"
+}
+
contains_this_1: {
options = {
evaluate: true,