From ad903e924050067a96a33f2eb5a0b9ab3e5454c1 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sat, 6 Mar 2021 14:49:39 +0000 Subject: fix corner cases with `export` (#4743) fixes #4742 --- test/compress/exports.js | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'test/compress') diff --git a/test/compress/exports.js b/test/compress/exports.js index 2da1ee33..a7239148 100644 --- a/test/compress/exports.js +++ b/test/compress/exports.js @@ -382,3 +382,62 @@ single_use_class_default: { A.prototype.p = "PASS"; } } + +issue_4742_join_vars_1: { + options = { + join_vars: true, + } + input: { + var a = 42; + export var a; + } + expect: { + var a = 42; + export var a; + } +} + +issue_4742_join_vars_2: { + options = { + join_vars: true, + } + input: { + export var a = "foo"; + var b; + b = "bar"; + } + expect: { + export var a = "foo"; + var b, b = "bar"; + } +} + +issue_4742_unused_1: { + options = { + unused: true, + } + input: { + var a = 42; + export var a; + } + expect: { + var a = 42; + export var a; + } +} + +issue_4742_unused_2: { + options = { + reduce_vars: true, + toplevel: true, + unused: true, + } + input: { + export var a = "foo"; + var a = "bar"; + } + expect: { + export var a = "foo"; + a = "bar"; + } +} -- cgit v1.2.3