Skip to content

Commit

Permalink
Avoid running drop_unused in nodes that aren't scopes. Closes #1457
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Oct 16, 2023
1 parent 1a99798 commit e0e5b7e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/compress/drop-unused.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ const r_keep_assign = /keep_assign/;
AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
if (!compressor.option("unused")) return;
if (compressor.has_directive("use asm")) return;
if (!this.variables) return; // not really a scope (eg: AST_Class)

var self = this;
if (self.pinned()) return;
var drop_funcs = !(self instanceof AST_Toplevel) || compressor.toplevel.funcs;
Expand Down

0 comments on commit e0e5b7e

Please sign in to comment.