aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js17
1 files changed, 5 insertions, 12 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 06873df8..1e096ade 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -316,7 +316,7 @@ merge(Compressor.prototype, {
if (def.scope.uses_eval || def.scope.uses_with) {
def.fixed = false;
} else if (!compressor.exposed(def)) {
- def.fixed = undefined;
+ def.fixed = def.init;
} else {
def.fixed = false;
}
@@ -329,10 +329,12 @@ merge(Compressor.prototype, {
function reset_variables(tw, compressor, node) {
node.variables.each(function(def) {
reset_def(compressor, def);
- if (def.fixed === undefined && def.orig[0].TYPE == "SymbolVar") {
- def.fixed = null;
+ if (def.fixed === null) {
def.safe_ids = tw.safe_ids;
mark(tw, def, true);
+ } else if (def.fixed) {
+ tw.loop_ids[def.id] = tw.in_loop;
+ mark(tw, def, true);
}
});
}
@@ -504,15 +506,6 @@ merge(Compressor.prototype, {
});
def(AST_Defun, function(tw, descend, compressor) {
this.inlined = false;
- var d = this.name.definition();
- if (compressor.exposed(d) || safe_to_read(tw, d)) {
- d.fixed = false;
- } else {
- d.fixed = this;
- d.single_use = ref_once(tw, compressor, d);
- tw.loop_ids[d.id] = tw.in_loop;
- mark(tw, d, true);
- }
var save_ids = tw.safe_ids;
tw.safe_ids = Object.create(null);
reset_variables(tw, compressor, this);