aboutsummaryrefslogtreecommitdiff
path: root/test/compress/pure_getters.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-20 17:38:40 +0800
committerGitHub <noreply@github.com>2018-02-20 17:38:40 +0800
commit39a907bde3161f74e298a7fc8502fb0f6a05eaed (patch)
tree3d1d62c3ea94e1b2050ea1a7400c8d5d4acae653 /test/compress/pure_getters.js
parent70474310f3ba7f2f4395117ad2d779ced016075b (diff)
downloadtracifyjs-39a907bde3161f74e298a7fc8502fb0f6a05eaed.tar.gz
tracifyjs-39a907bde3161f74e298a7fc8502fb0f6a05eaed.zip
workaround `pure_getters=true` when dropping unused assignments (#2939)
fixes #2938
Diffstat (limited to 'test/compress/pure_getters.js')
-rw-r--r--test/compress/pure_getters.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/compress/pure_getters.js b/test/compress/pure_getters.js
index 4e9ae4f4..82229d4b 100644
--- a/test/compress/pure_getters.js
+++ b/test/compress/pure_getters.js
@@ -721,3 +721,54 @@ issue_2838: {
}
expect_stdout: "PASS"
}
+
+issue_2938_1: {
+ options = {
+ pure_getters: true,
+ unused: true,
+ }
+ input: {
+ function f(a) {
+ a.b = "PASS";
+ }
+ var o = {};
+ 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_2: {
+ options = {
+ pure_getters: true,
+ toplevel: true,
+ unused: true,
+ }
+ input: {
+ var Parser = function Parser() {};
+ var p = Parser.prototype;
+ p.initialContext = function initialContext() {
+ 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"
+}