aboutsummaryrefslogtreecommitdiff
path: root/lib/scope.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scope.js')
-rw-r--r--lib/scope.js9
1 files changed, 5 insertions, 4 deletions
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;
});
}
});