mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(transformer/class-properties): simplify determining if class is declaration (#8357)
Small improvement. Use `Class::type` field to determine if class is declaration/expression. Not sure why it did it in such a complicated way previously!
This commit is contained in:
parent
e4d66e4636
commit
6790d1d219
1 changed files with 1 additions and 6 deletions
|
|
@ -65,12 +65,7 @@ impl<'a> ClassProperties<'a, '_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get basic details about class
|
// Get basic details about class
|
||||||
let is_declaration = match ctx.ancestor(1) {
|
let is_declaration = *class.r#type() == ClassType::ClassDeclaration;
|
||||||
Ancestor::ExportDefaultDeclarationDeclaration(_)
|
|
||||||
| Ancestor::ExportNamedDeclarationDeclaration(_) => true,
|
|
||||||
grandparent => grandparent.is_parent_of_statement(),
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut class_name_binding = class.id().as_ref().map(BoundIdentifier::from_binding_ident);
|
let mut class_name_binding = class.id().as_ref().map(BoundIdentifier::from_binding_ident);
|
||||||
let class_scope_id = class.scope_id().get().unwrap();
|
let class_scope_id = class.scope_id().get().unwrap();
|
||||||
let has_super_class = class.super_class().is_some();
|
let has_super_class = class.super_class().is_some();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue