mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
feat(ast): enter/leave ClassBody and PrivateInExpression (#1792)
This commit is contained in:
parent
1feec95a94
commit
d41e3fd268
2 changed files with 11 additions and 1 deletions
|
|
@ -468,9 +468,12 @@ pub trait Visit<'a>: Sized {
|
|||
}
|
||||
|
||||
fn visit_class_body(&mut self, body: &ClassBody<'a>) {
|
||||
let kind = AstKind::ClassBody(self.alloc(body));
|
||||
self.enter_node(kind);
|
||||
for elem in &body.body {
|
||||
self.visit_class_element(elem);
|
||||
}
|
||||
self.leave_node(kind);
|
||||
}
|
||||
|
||||
fn visit_class_element(&mut self, elem: &ClassElement<'a>) {
|
||||
|
|
@ -836,8 +839,11 @@ pub trait Visit<'a>: Sized {
|
|||
}
|
||||
|
||||
fn visit_private_in_expression(&mut self, expr: &PrivateInExpression<'a>) {
|
||||
let kind = AstKind::PrivateInExpression(self.alloc(expr));
|
||||
self.enter_node(kind);
|
||||
self.visit_private_identifier(&expr.left);
|
||||
self.visit_expression(&expr.right);
|
||||
self.leave_node(kind);
|
||||
}
|
||||
|
||||
fn visit_sequence_expression(&mut self, expr: &SequenceExpression<'a>) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@ impl Rule for ConstructorSuper {
|
|||
if ctor.kind != MethodDefinitionKind::Constructor || ctor.value.body.is_none() {
|
||||
return;
|
||||
}
|
||||
let Some(AstKind::Class(class)) = ctx.nodes().parent_kind(node.id()) else { return };
|
||||
let Some(AstKind::Class(class)) =
|
||||
ctx.nodes().parent_id(node.id()).and_then(|id| ctx.nodes().parent_kind(id))
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
// In cases where there's no super-class, calling 'super()' inside the constructor
|
||||
// is handled by the parser.
|
||||
|
|
|
|||
Loading…
Reference in a new issue