Skip to content

Commit

Permalink
speed up collapse_vars (#3119)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlamsl authored May 4, 2018
1 parent c4cebb4 commit d835c72
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,9 +1062,11 @@ merge(Compressor.prototype, {
if (is_lhs(node, parent)) {
if (value_def) replaced++;
return node;
} else {
replaced++;
if (value_def && candidate instanceof AST_VarDef) return node;
}
CHANGED = abort = true;
replaced++;
compressor.info("Collapsing {name} [{file}:{line},{col}]", {
name: node.print_to_string(),
file: node.start.file,
Expand All @@ -1075,10 +1077,6 @@ merge(Compressor.prototype, {
return make_node(AST_UnaryPrefix, candidate, candidate);
}
if (candidate instanceof AST_VarDef) {
if (value_def) {
abort = false;
return node;
}
var def = candidate.name.definition();
if (def.references.length - def.replaced == 1 && !compressor.exposed(def)) {
def.replaced++;
Expand Down

0 comments on commit d835c72

Please sign in to comment.