aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 89d698da..76be4753 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -4453,7 +4453,12 @@ merge(Compressor.prototype, {
node.value.walk(tw);
mark(node.name, true);
} else {
- declarations.add(node.name.definition().id, node.name);
+ var id = node.name.definition().id;
+ if (!(id in references)) {
+ declarations.add(id, node.name);
+ } else if (references[id]) {
+ references[id].push(node.name);
+ }
}
return true;
}
@@ -4478,11 +4483,6 @@ merge(Compressor.prototype, {
continue;
}
var orig = [], refs = [];
- if (declarations.has(id)) declarations.get(id).forEach(function(sym) {
- sym.thedef = def;
- sym.name = def.name;
- orig.push(sym);
- });
references[id].forEach(function(sym) {
sym.thedef = def;
sym.name = def.name;
@@ -4529,7 +4529,8 @@ merge(Compressor.prototype, {
} else if (self.variables.get(def.name) !== def || compressor.exposed(def)) {
references[def.id] = false;
} else {
- var refs = [ sym ];
+ var refs = declarations.get(def.id) || [];
+ refs.push(sym);
references[def.id] = refs;
if (write_only) {
refs.segment = segment;