Skip to content

refactor(ast): make AstBuilder not Copy#11239

Closed
overlookmotel wants to merge 1 commit intographite-base/11239from
05-23-refactor_ast_make_astbuilder_not_copy_
Closed

refactor(ast): make AstBuilder not Copy#11239
overlookmotel wants to merge 1 commit intographite-base/11239from
05-23-refactor_ast_make_astbuilder_not_copy_

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented May 23, 2025

Incomplete. This breaks a ton of code.

Remove #[derive(Clone, Copy)] from AstBuilder, so we can make it stateful. Alter codegen to make all AstBuilder methods take &self instead of self.

We'll need to refactor a lot of code which uses AstBuilder methods to work around borrow-checker problems that this change introduces.

@github-actions github-actions bot added A-ast Area - AST A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels May 23, 2025
Copy link
Member Author

overlookmotel commented May 23, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@graphite-app graphite-app bot force-pushed the 05-23-refactor_ast_make_astbuilder_not_copy_ branch from dacb570 to c445538 Compare May 23, 2025 06:57
@graphite-app graphite-app bot changed the base branch from 05-23-refactor_ast_move_astbuilder_type_definition to graphite-base/11239 May 24, 2025 02:45
@overlookmotel
Copy link
Member Author

The issue which originally prompted this work #11213 is now closed. We're taking a different approach now. But this work is still useful as if we complete it, we can count nodes, scopes, symbols etc in parser, and remove the extra AST pass to calculate these counts which currently happens before building Semantic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants