chained_evaluation_1: { options = { collapse_vars: true, evaluate: true, reduce_funcs: true, reduce_vars: true, unused: true, } input: { (function() { var a = 1; (function() { var b = a, c; c = f(b); c.bar = b; })(); })(); } expect: { (function() { (function() { f(1).bar = 1; })(); })(); } } chained_evaluation_2: { options = { collapse_vars: true, evaluate: true, reduce_funcs: true, reduce_vars: true, unused: true, } input: { (function() { var a = "long piece of string"; (function() { var b = a, c; c = f(b); c.bar = b; })(); })(); } expect: { (function() { (function() { var b = "long piece of string"; f(b).bar = b; })(); })(); } } the flow of data in JS program, based on UglifyJS
aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-02-21 02:00:34 +0000
committerGitHub <noreply@github.com>2021-02-21 10:00:34 +0800
commitbfe3a8b5161457062224959bbb9938c106503f97 (patch)
treee8d190a5e06daba29ee5c398d7e5861974b165ee /lib/scope.js
parentae09773ba017ce65b261d15ed3098ae40c3b2a1b (diff)
downloadtracifyjs-bfe3a8b5161457062224959bbb9938c106503f97.tar.gz
tracifyjs-bfe3a8b5161457062224959bbb9938c106503f97.zip
fix corner case with `import` (#4672)
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/scope.js b/lib/scope.js
index f638890f..97027274 100644
--- a/lib/scope.js
+++ b/lib/scope.js
@@ -197,7 +197,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
} else if (node instanceof AST_SymbolLet) {
scope.def_variable(node).exported = exported;
} else if (node instanceof AST_SymbolVar) {
- defun.def_variable(node, null).exported = exported;
+ defun.def_variable(node, node instanceof AST_SymbolImport ? undefined : null).exported = exported;
entangle(defun, scope);
}