Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jul 29, 2024
1 parent 8d460e0 commit 8998d29
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions crates/swc_ecma_minifier/src/compress/optimize/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,38 @@ impl Optimizer<'_> {
PropOrSpread::Prop(prop) => prop,
};

match &**prop {
Prop::Method(prop) => {
if contains_this_expr(&prop.function.body) {
return None;
}
}
Prop::Getter(prop) => {
if contains_this_expr(&prop.body) {
return None;
}
}
Prop::Setter(prop) => {
if contains_this_expr(&prop.body) {
return None;
}
}
Prop::KeyValue(prop) => match &*prop.value {
Expr::Fn(f) => {
if contains_this_expr(&f.function.body) {
return None;
}
}
Expr::Arrow(f) => {
if contains_this_expr(&f.body) {
return None;
}
}
_ => {}
},
_ => {}
}

if contains_this_expr(prop) {
return None;
}
Expand Down

0 comments on commit 8998d29

Please sign in to comment.