Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/oxc_minifier/src/peephole/remove_unused_declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ mod test {
&options,
);

// decorators
test_same_options("class C { @dec foo() {} }", &options);

// TypeError
test_same_options("class C extends (() => {}) {}", &options);
}
Expand Down
4 changes: 4 additions & 0 deletions crates/oxc_minifier/src/peephole/remove_unused_expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ impl<'a> PeepholeOptimizations {
// Keep the entire class if non-empty static block exists.
for e in &c.body.body {
match e {
e if e.has_decorator() => return None,
ClassElement::TSIndexSignature(_) => return None,
ClassElement::StaticBlock(block) => {
if !block.body.is_empty() {
Expand Down Expand Up @@ -1132,6 +1133,9 @@ mod test {
&options,
);

// decorators
test_same_options("(class { @dec foo() {} })", &options);

// TypeError
test_same_options("(class extends (() => {}) {})", &options);
}
Expand Down
Loading