aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Lam S.L <alexlamsl@gmail.com>2021-05-29 20:16:18 +0100
committerGitHub <noreply@github.com>2021-05-30 03:16:18 +0800
commit8d23496e0fdf40f74273e7158417ff992006fe69 (patch)
tree63e093db8f89609b40d1ed3b424e229abe191ea8 /lib
parent260431f4e00be191a9c5db191c66e552898b0708 (diff)
downloadtracifyjs-8d23496e0fdf40f74273e7158417ff992006fe69.tar.gz
tracifyjs-8d23496e0fdf40f74273e7158417ff992006fe69.zip
fix corner case in `dead_code` (#4981)
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index cba78462..4c967074 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -3638,11 +3638,17 @@ merge(Compressor.prototype, {
}
function extract_declarations_from_unreachable_code(compressor, stat, target) {
- if (!(stat instanceof AST_Definitions || stat instanceof AST_LambdaDefinition)) {
+ if (!(stat instanceof AST_DefClass
+ || stat instanceof AST_Definitions
+ || stat instanceof AST_LambdaDefinition)) {
AST_Node.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start);
}
var block;
stat.walk(new TreeWalker(function(node, descend) {
+ if (node instanceof AST_DefClass) {
+ push(node);
+ return true;
+ }
if (node instanceof AST_Definitions) {
var defns = [];
if (node.remove_initializers(compressor, defns)) {