aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2020-04-22 22:27:26 +0100
committerGitHub <noreply@github.com>2020-04-23 05:27:26 +0800
commit3ae24329eb29c9b1c924c16778348e7ae7efc510 (patch)
tree4fd522c298a35e5d1af6ae51c367990abc4d8d62 /lib/compress.js
parent01b13d797cdeabecad25c33e039fd3ec848b71d0 (diff)
downloadtracifyjs-3ae24329eb29c9b1c924c16778348e7ae7efc510.tar.gz
tracifyjs-3ae24329eb29c9b1c924c16778348e7ae7efc510.zip
gate various label-related transformations (#3812)
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 6926b357..2878385a 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3962,11 +3962,12 @@ merge(Compressor.prototype, {
});
OPT(AST_LabeledStatement, function(self, compressor) {
- if (self.body instanceof AST_Break
+ if (compressor.option("dead_code")
+ && self.body instanceof AST_Break
&& compressor.loopcontrol_target(self.body) === self.body) {
return make_node(AST_EmptyStatement, self);
}
- return self.label.references.length == 0 ? self.body : self;
+ return compressor.option("unused") && self.label.references.length == 0 ? self.body : self;
});
OPT(AST_Block, function(self, compressor) {