aboutsummaryrefslogtreecommitdiff
path: root/test/compress/pure_getters.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-21 04:19:42 +0800
committerGitHub <noreply@github.com>2018-02-21 04:19:42 +0800
commit29a71d3aae24e12bbdf5d9a99c8423b482de3e40 (patch)
treeaa7a6b7a0d8c20910ba7feaafa166398b15186fe /test/compress/pure_getters.js
parent39a907bde3161f74e298a7fc8502fb0f6a05eaed (diff)
downloadtracifyjs-29a71d3aae24e12bbdf5d9a99c8423b482de3e40.tar.gz
tracifyjs-29a71d3aae24e12bbdf5d9a99c8423b482de3e40.zip
more tests for #2938 (#2940)
Diffstat (limited to 'test/compress/pure_getters.js')
-rw-r--r--test/compress/pure_getters.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js
index 82229d4b..e2662868 100644
--- a/test/compress/pure_getters.js
+++ b/test/compress/pure_getters.js
@@ -772,3 +772,61 @@ issue_2938_2: {
}
expect_stdout: "PASS"
}
+
+issue_2938_3: {
+ options = {
+ pure_getters: true,
+ side_effects: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ var unused = a.a;
+ a.b = "PASS";
+ a.c;
+ }
+ var o = {};
+ o.d;
+ f(o);
+ console.log(o.b);
+ }
+ expect: {
+ function f(a) {
+ a.b = "PASS";
+ }
+ var o = {};
+ f(o);
+ console.log(o.b);
+ }
+ expect_stdout: "PASS"
+}
+
+issue_2938_4: {
+ options = {
+ pure_getters: true,
+ side_effects: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var Parser = function Parser() {};
+ var p = Parser.prototype;
+ var unused = p.x;
+ p.initialContext = function initialContext() {
+ p.y;
+ console.log("PASS");
+ };
+ p.braceIsBlock = function() {};
+ (new Parser).initialContext();
+ }
+ expect: {
+ var Parser = function() {};
+ var p = Parser.prototype;
+ p.initialContext = function() {
+ console.log("PASS");
+ };
+ p.braceIsBlock = function() {};
+ (new Parser).initialContext();
+ }
+ expect_stdout: "PASS"
+}