Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
hyf0 committed Nov 20, 2022
1 parent 4ba72f1 commit 9ba2288
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions crates/swc_ecma_minifier/src/compress/optimize/unused.rs
Expand Up @@ -480,9 +480,20 @@ where

// Fix https://github.com/swc-project/swc/issues/5588
let may_have_side_effect = class.body.iter().any(|m| match m {
ClassMember::ClassProp(m) => m.is_static && m.value.is_some(),
ClassMember::PrivateProp(m) => m.is_static && m.value.is_some(),
ClassMember::StaticBlock(m) => !m.body.stmts.is_empty(),
ClassMember::ClassProp(ClassProp {
is_static: true,
value: Some(_),
..
})
| ClassMember::PrivateProp(PrivateProp {
is_static: true,
value: Some(_),
..
}) => true,
ClassMember::StaticBlock(StaticBlock {
body: BlockStmt { stmts, .. },
..
}) if !stmts.is_empty() => true,
_ => false,
});
if may_have_side_effect {
Expand Down

0 comments on commit 9ba2288

Please sign in to comment.