aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-11-18 15:43:55 +0000
committerGitHub <noreply@github.com>2020-11-18 23:43:55 +0800
commitf6a83f794456c65ba927c0ccf55ff88c5c003a66 (patch)
treeaab67c440c0011df3bfc21392c82bea5ab61cc1c /test/compress
parent35283e5dd18bb2b3be46a25786e2e73e8a24a863 (diff)
downloadtracifyjs-f6a83f794456c65ba927c0ccf55ff88c5c003a66.tar.gz
tracifyjs-f6a83f794456c65ba927c0ccf55ff88c5c003a66.zip
fix corner case in `merge_vars` (#4299)
fixes #4298
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/destructured.js44
1 files changed, 41 insertions, 3 deletions
diff --git a/test/compress/destructured.js b/test/compress/destructured.js
index 4ef28864..cebb70ae 100644
--- a/test/compress/destructured.js
+++ b/test/compress/destructured.js
@@ -1490,10 +1490,10 @@ issue_4294: {
expect: {
A = "PASS";
(function() {
- var a = function({
- [a]: {},
+ var b = function({
+ [b]: {},
}) {}({
- [a]: 0,
+ [b]: 0,
});
var b = A;
console.log(b);
@@ -1502,3 +1502,41 @@ issue_4294: {
expect_stdout: "PASS"
node_version: ">=6"
}
+
+issue_4298: {
+ options = {
+ merge_vars: true,
+ }
+ input: {
+ (function() {
+ var a = {
+ object: "PASS",
+ };
+ function f({
+ [typeof a]: b,
+ }) {
+ var a = b;
+ return a;
+ }
+ var c = f(a);
+ console.log(c);
+ })();
+ }
+ expect: {
+ (function() {
+ var a = {
+ object: "PASS",
+ };
+ function f({
+ [typeof a]: b,
+ }) {
+ var a = b;
+ return a;
+ }
+ var c = f(a);
+ console.log(c);
+ })();
+ }
+ expect_stdout: "PASS"
+ node_version: ">=6"
+}