aboutsummaryrefslogtreecommitdiff
path: root/test/compress/properties.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-06-19 18:20:11 +0800
committerGitHub <noreply@github.com>2018-06-19 18:20:11 +0800
commite54ddcbb8a675940f77e05a5f04c3a208268b41a (patch)
tree4e879bd33c839320bab9e0ef58190e13b4f3d729 /test/compress/properties.js
parent9e19e63551907be19c8c6b5b75217d7650504436 (diff)
downloadtracifyjs-e54ddcbb8a675940f77e05a5f04c3a208268b41a.tar.gz
tracifyjs-e54ddcbb8a675940f77e05a5f04c3a208268b41a.zip
fix corner cases in `properties` (#3189)
fixes #3188
Diffstat (limited to 'test/compress/properties.js')
-rw-r--r--test/compress/properties.js103
1 files changed, 103 insertions, 0 deletions
diff --git a/test/compress/properties.js b/test/compress/properties.js
index efe0d491..d36ae074 100644
--- a/test/compress/properties.js
+++ b/test/compress/properties.js
@@ -1729,3 +1729,106 @@ issue_869_2: {
}
expect_stdout: "PASS"
}
+
+issue_3188_1: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ properties: true,
+ reduce_vars: true,
+ side_effects: true,
+ }
+ input: {
+ (function() {
+ function f() {
+ console.log(this.p);
+ }
+ (function() {
+ var o = {
+ p: "PASS",
+ f: f
+ };
+ o.f();
+ })();
+ })();
+ }
+ expect: {
+ (function() {
+ function f() {
+ console.log(this.p);
+ }
+ ({
+ p: "PASS",
+ f: f
+ }).f();
+ var o;
+ })();
+ }
+ expect_stdout: "PASS"
+}
+
+issue_3188_2: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ properties: true,
+ reduce_vars: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ (function() {
+ var f = function() {
+ console.log(this.p);
+ };
+ function g() {
+ var o = {
+ p: "PASS",
+ f: f
+ };
+ o.f();
+ }
+ g();
+ })();
+ }
+ expect: {
+ ({
+ p: "PASS",
+ f: function() {
+ console.log(this.p);
+ }
+ }).f();
+ }
+ expect_stdout: "PASS"
+}
+
+issue_3188_3: {
+ options = {
+ collapse_vars: true,
+ inline: true,
+ properties: true,
+ reduce_vars: true,
+ side_effects: true,
+ }
+ input: {
+ (function() {
+ function f() {
+ console.log(this[0]);
+ }
+ (function() {
+ var o = ["PASS", f];
+ o[1]();
+ })();
+ })();
+ }
+ expect: {
+ (function() {
+ function f() {
+ console.log(this[0]);
+ }
+ ["PASS", f][1]();
+ var o;
+ })();
+ }
+ expect_stdout: "PASS"
+}