aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2018-02-08 03:31:51 +0800
committerGitHub <noreply@github.com>2018-02-08 03:31:51 +0800
commitd66d86f20bc231bd8d305ee5ba05efa77aa8b6be (patch)
tree1eae73edc0f4fab7d3dbffc5dd94736953ac6dbf /test
parent905325d3e21a5dc3d3f5835f609f30055c25bf2b (diff)
downloadtracifyjs-d66d86f20bc231bd8d305ee5ba05efa77aa8b6be.tar.gz
tracifyjs-d66d86f20bc231bd8d305ee5ba05efa77aa8b6be.zip
account for exceptions in `AST_Assign.left` (#2892)
fixes #2891
Diffstat (limited to 'test')
-rw-r--r--test/compress/collapse_vars.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/compress/collapse_vars.js b/test/compress/collapse_vars.js
index 19db6058..ed1d8d97 100644
--- a/test/compress/collapse_vars.js
+++ b/test/compress/collapse_vars.js
@@ -4461,3 +4461,59 @@ issue_2878: {
}
expect_stdout: "1"
}
+
+issue_2891_1: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ var a = "PASS", b;
+ try {
+ b = c.p = 0;
+ a = "FAIL";
+ b();
+ } catch (e) {
+ }
+ console.log(a);
+ }
+ expect: {
+ var a = "PASS", b;
+ try {
+ b = c.p = 0;
+ a = "FAIL";
+ b();
+ } catch (e) {
+ }
+ console.log(a);
+ }
+ expect_stdout: "PASS"
+}
+
+issue_2891_2: {
+ options = {
+ collapse_vars: true,
+ }
+ input: {
+ "use strict";
+ var a = "PASS", b;
+ try {
+ b = c = 0;
+ a = "FAIL";
+ b();
+ } catch (e) {
+ }
+ console.log(a);
+ }
+ expect: {
+ "use strict";
+ var a = "PASS", b;
+ try {
+ b = c = 0;
+ a = "FAIL";
+ b();
+ } catch (e) {
+ }
+ console.log(a);
+ }
+ expect_stdout: true
+}