From 8af2f5fbcf91279db86f71e9a889d69b262370c5 Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Tue, 15 Oct 2019 19:44:07 +0800 Subject: fix corner case in `rename` (#3481) fixes #3480 --- lib/scope.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/scope.js') diff --git a/lib/scope.js b/lib/scope.js index 7da982a0..01a67b7d 100644 --- a/lib/scope.js +++ b/lib/scope.js @@ -511,13 +511,14 @@ AST_Toplevel.DEFMETHOD("expand_names", function(options) { if (def.global && options.cache) return; if (def.unmangleable(options)) return; if (options.reserved.has[def.name]) return; - var d = def.redefined(); - def.name = d ? d.name : next_name(); + var redef = def.redefined(); + var name = redef ? redef.rename || redef.name : next_name(); + def.rename = name; def.orig.forEach(function(sym) { - sym.name = def.name; + sym.name = name; }); def.references.forEach(function(sym) { - sym.name = def.name; + sym.name = name; }); } }); -- cgit v1.2.3