Skip to content

Commit

Permalink
Refactor: Shorten code
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Nov 18, 2024
1 parent 5a3f8dd commit 5e98029
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions crates/oxc_transformer/src/es2022/class_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,11 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {
return 0;
}

self.is_declaration = false;

let class_name = match &class.id {
self.class_name = ClassName::Name(match &class.id {
Some(id) => id.name.as_str(),
None => "Class",
};
self.class_name = ClassName::Name(class_name);
});
self.is_declaration = false;

self.transform_class(class, ctx);

Expand All @@ -295,7 +293,7 @@ impl<'a, 'ctx> ClassProperties<'a, 'ctx> {

if expr_count > 0 {
// We're going to replace class expression with a sequence expression
// `(..., _C = class C {}, ..., _C)` so this class will be visited again.
// `(..., _C = class C {}, ..., _C)`, so this class will be visited again.
// Store the `Address` of class in stack. This will cause bail-out when we re-visit it.
self.class_expression_addresses_stack.push(class_address);
}
Expand Down

0 comments on commit 5e98029

Please sign in to comment.