aboutsummaryrefslogtreecommitdiff
path: root/test/compress/reduce_vars.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2017-10-22 03:23:31 +0800
committerGitHub <noreply@github.com>2017-10-22 03:23:31 +0800
commit011123223b8e45ab3f6d151ad038a6b8ecec2434 (patch)
treead0bc67f61e0dc733a584ba3f7e996389deccaf5 /test/compress/reduce_vars.js
parent96439ca24690782dc67c5cc3768226bf96c38885 (diff)
downloadtracifyjs-011123223b8e45ab3f6d151ad038a6b8ecec2434.tar.gz
tracifyjs-011123223b8e45ab3f6d151ad038a6b8ecec2434.zip
fix `unsafe` escape analysis in `reduce_vars` (#2387)
Diffstat (limited to 'test/compress/reduce_vars.js')
-rw-r--r--test/compress/reduce_vars.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/compress/reduce_vars.js b/test/compress/reduce_vars.js
index a03bc1c8..681dafd3 100644
--- a/test/compress/reduce_vars.js
+++ b/test/compress/reduce_vars.js
@@ -2954,3 +2954,32 @@ const_expr_2: {
}
expect_stdout: "2 2"
}
+
+escaped_prop: {
+ options = {
+ collapse_vars: true,
+ evaluate: true,
+ inline: true,
+ pure_getters: "strict",
+ reduce_vars: true,
+ side_effects: true,
+ toplevel: true,
+ unsafe: true,
+ unused: true,
+ }
+ input: {
+ var obj = { o: { a: 1 } };
+ (function(o) {
+ o.a++;
+ })(obj.o);
+ (function(o) {
+ console.log(o.a);
+ })(obj.o);
+ }
+ expect: {
+ var obj = { o: { a: 1 } };
+ obj.o.a++;
+ console.log(obj.o.a);
+ }
+ expect_stdout: "2"
+}