Skip to content

Commit

Permalink
fix: incorrect reference count
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Jul 19, 2024
1 parent 8a2971b commit aca858f
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,14 @@ impl<'a> Visit<'a> for Collector {
self.node += 1;
}

#[inline]
fn visit_jsx_identifier(&mut self, _: &JSXIdentifier<'a>) {
self.reference += 1;
self.node += 1;
}

#[inline]
fn visit_jsx_member_expression_object(&mut self, it: &JSXMemberExpressionObject<'a>) {
self.node += 1;
if let JSXMemberExpressionObject::MemberExpression(expr) = &it {
self.visit_jsx_member_expression(expr);
} else {
self.node += 1;
self.reference += 1;
}
}

Expand All @@ -162,18 +157,6 @@ impl<'a> Visit<'a> for Collector {
}
}

#[inline]
fn visit_jsx_attribute_name(&mut self, it: &JSXAttributeName<'a>) {
// NOTE: AstKind doesn't exists!
// self.node += 1;

if let JSXAttributeName::NamespacedName(name) = it {
self.visit_jsx_namespaced_name(name);
} else {
self.node += 1;
}
}

#[inline]
fn visit_ts_enum_member_name(&mut self, it: &TSEnumMemberName<'a>) {
if !it.is_expression() {
Expand Down Expand Up @@ -657,6 +640,10 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
self.visit_directive(directive);
}

if let Some(hashbang) = &program.hashbang {
self.visit_hashbang(hashbang);
}

self.visit_statements(&program.body);

/* cfg */
Expand Down

0 comments on commit aca858f

Please sign in to comment.