Skip to content

Commit

Permalink
fix(traverse): add missing visitors to ChildScopeCollector (#5118)
Browse files Browse the repository at this point in the history
`ChildScopeCollector` was missing visitors for a few nodes which have recently had scopes added to them.
  • Loading branch information
overlookmotel committed Aug 23, 2024
1 parent f771d7c commit 25d6e20
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/oxc_traverse/src/context/scoping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,11 @@ impl ChildScopeCollector {
}

impl<'a> Visit<'a> for ChildScopeCollector {
#[inline]
fn visit_program(&mut self, program: &Program<'a>) {
self.add_scope(&program.scope_id);
}

#[inline]
fn visit_block_statement(&mut self, stmt: &BlockStatement<'a>) {
self.add_scope(&stmt.scope_id);
Expand Down Expand Up @@ -614,4 +619,22 @@ impl<'a> Visit<'a> for ChildScopeCollector {
fn visit_ts_conditional_type(&mut self, it: &TSConditionalType<'a>) {
self.add_scope(&it.scope_id);
}

#[inline]
fn visit_ts_type_alias_declaration(&mut self, it: &TSTypeAliasDeclaration<'a>) {
self.add_scope(&it.scope_id);
}

#[inline]
fn visit_ts_method_signature(&mut self, it: &TSMethodSignature<'a>) {
self.add_scope(&it.scope_id);
}

#[inline]
fn visit_ts_construct_signature_declaration(
&mut self,
it: &TSConstructSignatureDeclaration<'a>,
) {
self.add_scope(&it.scope_id);
}
}

0 comments on commit 25d6e20

Please sign in to comment.