From a39bdb584097b376250e6d09cd9ee9453b9f43de Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 14 Oct 2019 13:34:35 +0800 Subject: fix corner case with `collapse_vars` & `ie8` (#3469) fixes #3468 --- lib/compress.js | 3 +-- lib/scope.js | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/compress.js b/lib/compress.js index 29ef07c3..06ba43c0 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -896,8 +896,7 @@ merge(Compressor.prototype, { if (lhs instanceof AST_This) return true; if (lhs instanceof AST_SymbolRef) { var def = lhs.definition(); - return def.orig[0] instanceof AST_SymbolLambda - || compressor.exposed(def) && identifier_atom[def.name]; + return def.lambda || compressor.exposed(def) && identifier_atom[def.name]; } if (lhs instanceof AST_PropAccess) { lhs = lhs.expression; diff --git a/lib/scope.js b/lib/scope.js index 08c9efd8..83df3fde 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -55,6 +55,7 @@ function SymbolDef(scope, orig, init) { this.mangled_name = null; this.undeclared = false; this.id = SymbolDef.next_id++; + this.lambda = orig instanceof AST_SymbolLambda; } SymbolDef.next_id = 1; @@ -210,6 +211,7 @@ AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) { node.thedef = new_def; node.reference(options); }); + if (old_def.lambda) new_def.lambda = true; } }); -- cgit v1.2.3