aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 9e516a89..d4a72d74 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -285,6 +285,10 @@ merge(Compressor.prototype, {
AST_Node.DEFMETHOD("reset_opt_flags", function(compressor, rescan) {
var reduce_vars = rescan && compressor.option("reduce_vars");
+ // Stack of look-up tables to keep track of whether a `SymbolDef` has been
+ // properly assigned before use:
+ // - `push()` & `pop()` when visiting conditional branches
+ // - backup & restore via `save_ids` when visiting out-of-order sections
var safe_ids = Object.create(null);
var suppressor = new TreeWalker(function(node) {
if (!(node instanceof AST_Symbol)) return;
@@ -391,10 +395,9 @@ merge(Compressor.prototype, {
return true;
}
if (node instanceof AST_Accessor) {
- var save_ids = safe_ids;
- safe_ids = Object.create(null);
+ push();
descend();
- safe_ids = save_ids;
+ pop();
return true;
}
if (node instanceof AST_Binary