aboutsummaryrefslogtreecommitdiff
path: root/test/compress
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-10 01:13:38 +0000
committerGitHub <noreply@github.com>2021-02-10 09:13:38 +0800
commitc76481341ca62e6c651f4bc8db7ed3508423b421 (patch)
treee61786c06e30ce6b49a2bf28efa7abba80aef5b6 /test/compress
parent5e6307974fa2b1e7972ab8c58b636eaed47a54fb (diff)
downloadtracifyjs-c76481341ca62e6c651f4bc8db7ed3508423b421.tar.gz
tracifyjs-c76481341ca62e6c651f4bc8db7ed3508423b421.zip
fix corner case in `merge_vars` (#4635)
Diffstat (limited to 'test/compress')
-rw-r--r--test/compress/yields.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/compress/yields.js b/test/compress/yields.js
index 7f85059b..5a6948ed 100644
--- a/test/compress/yields.js
+++ b/test/compress/yields.js
@@ -602,6 +602,62 @@ inline_nested_yield: {
node_version: ">=4"
}
+issue_4454_1: {
+ rename = false
+ options = {
+ merge_vars: true,
+ }
+ input: {
+ function f(a) {
+ (function*(b = console.log(a)) {})();
+ var yield = 42..toString();
+ console.log(yield);
+ }
+ f("PASS");
+ }
+ expect: {
+ function f(a) {
+ (function*(b = console.log(a)) {})();
+ var yield = 42..toString();
+ console.log(yield);
+ }
+ f("PASS");
+ }
+ expect_stdout: [
+ "PASS",
+ "42",
+ ]
+ node_version: ">=6"
+}
+
+issue_4454_2: {
+ rename = true
+ options = {
+ merge_vars: true,
+ }
+ input: {
+ function f(a) {
+ (function*(b = console.log(a)) {})();
+ var yield = 42..toString();
+ console.log(yield);
+ }
+ f("PASS");
+ }
+ expect: {
+ function f(b) {
+ (function*(c = console.log(b)) {})();
+ var b = 42..toString();
+ console.log(b);
+ }
+ f("PASS");
+ }
+ expect_stdout: [
+ "PASS",
+ "42",
+ ]
+ node_version: ">=6"
+}
+
issue_4618: {
options = {
functions: true,