Skip to content

Commit

Permalink
refactor(transformer/class-properties): remove pointless method (#7592)
Browse files Browse the repository at this point in the history
#7516 removed the need for a special method to handle `export default class {}`. Delete it.
  • Loading branch information
overlookmotel committed Dec 3, 2024
1 parent 0eadd9f commit 802233d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
23 changes: 0 additions & 23 deletions crates/oxc_transformer/src/es2022/class_properties/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,29 +177,6 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
return;
}

self.transform_class_declaration_impl(class, stmt_address, ctx);
}

/// Transform `export default class {}`.
///
/// Separate function as this is only circumstance where have to deal with anonymous class declaration,
/// and it's an uncommon case (can only be 1 per file).
// TODO: This method is now defunct. Can just have 1 `transform_class_declaration` function.
pub(super) fn transform_class_export_default(
&mut self,
class: &mut Class<'a>,
stmt_address: Address,
ctx: &mut TraverseCtx<'a>,
) {
self.transform_class_declaration_impl(class, stmt_address, ctx);
}

fn transform_class_declaration_impl(
&mut self,
class: &mut Class<'a>,
stmt_address: Address,
ctx: &mut TraverseCtx<'a>,
) {
self.is_declaration = true;

self.transform_class(class, ctx);
Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_transformer/src/es2022/class_properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ impl<'a, 'ctx> Traverse<'a> for ClassProperties<'a, 'ctx> {
let stmt_address = decl.address();
if let ExportDefaultDeclarationKind::ClassDeclaration(class) = &mut decl.declaration
{
self.transform_class_export_default(class, stmt_address, ctx);
self.transform_class_declaration(class, stmt_address, ctx);
}
}
_ => {}
Expand Down

0 comments on commit 802233d

Please sign in to comment.