feat(ast): add AST creation methods to AST types#23650
Conversation
|
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.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Merging this PR will not alter performance
Comparing Footnotes
|
7cab202 to
6a2e997
Compare
662766a to
faeb137
Compare
6a2e997 to
6143bb3
Compare
faeb137 to
0f7f1c2
Compare

Part of #23043.
Codegen AST builder methods on AST types, matching the methods which are generated on current
AstBuidlertype.Add a single new
AstBuildertype which is the simplest possible - just creates all nodes with dummyNodeIds - same as current builder does. But this PR includes the traits to add otherAstBuildimplementations later e.g. a builder for transformer which generates uniqueNodeIdfor each AST node.Design is much the same as outlined in #23043 but:
Expression::new_null_literalnotExpression::null_literal. This naming is more verbose, but clearer, and avoids clashing with existing methods e.g.ModuleExportName::identifier_name.Note: All these methods are inlined (they need to be, to make AST nodes be constructed in arena directly, not built on stack and copied to arena). So the traits should not have any affect on binary size.