Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(semantic): remove record_ast_node call for Program #5701

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions crates/oxc_semantic/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,15 +606,14 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
// Don't call `enter_node` here as `Program` is a special case - node has no `parent_id`.
// Inline the specific logic for `Program` here instead.
// This avoids `Nodes::add_node` having to handle the special case.
// We can also skip calling `self.enter_kind`, and `self.jsdoc.retrieve_attached_jsdoc`
// as they are no-ops for `Program`.
// We can also skip calling `self.enter_kind`, `self.record_ast_node`
// and `self.jsdoc.retrieve_attached_jsdoc`, as they are all no-ops for `Program`.
self.current_node_id = self.nodes.add_program_node(
kind,
self.current_scope_id,
control_flow!(self, |cfg| cfg.current_node_ix),
self.current_node_flags,
);
self.record_ast_node();

// Don't call `enter_scope` here as `Program` is a special case - scope has no `parent_id`.
// Inline the specific logic for `Program` here instead.
Expand Down