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

semantic: directly record real node ID when adding a scope to the scope-tree #4234

Closed
lucab opened this issue Jul 12, 2024 · 0 comments · Fixed by #4265
Closed

semantic: directly record real node ID when adding a scope to the scope-tree #4234

lucab opened this issue Jul 12, 2024 · 0 comments · Fixed by #4265
Labels
A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Comments

@lucab
Copy link
Collaborator

lucab commented Jul 12, 2024

From #4208 (comment):

Once #4203 is merged, node IDs will be generated before scope is created, so we can add node_id to params of this function, and push the actual AstNodeId here. Then we can remove set_node_id.

In particular, this is about refactoring the logic here below and getting rid of the dummy node ID:

pub fn add_scope(&mut self, parent_id: Option<ScopeId>, flags: ScopeFlags) -> ScopeId {
let scope_id = self.parent_ids.push(parent_id);
_ = self.child_ids.push(vec![]);
_ = self.flags.push(flags);
_ = self.bindings.push(Bindings::default());
_ = self.node_ids.push(AstNodeId::dummy());
// Set this scope as child of parent scope.
if let Some(parent_id) = parent_id {
self.child_ids[parent_id].push(scope_id);
}
scope_id
}

@lucab lucab added the C-bug Category - Bug label Jul 12, 2024
@lucab lucab added A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior and removed C-bug Category - Bug labels Jul 13, 2024
@Dunqing Dunqing closed this as completed Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants