feat(semantic): add methods to check if AST contains any/all node types#12227
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. |
CodSpeed Instrumentation Performance ReportMerging #12227 will not alter performanceComparing Summary
|
42a07b3 to
6a10b4d
Compare
6a10b4d to
74e03f9
Compare
09291b4 to
cd7d601
Compare
74e03f9 to
891c8d1
Compare
cd7d601 to
1449a81
Compare
|
You might find that |
|
Closing in favor of #13137 |
|
Is it OK to delete the branches for these 3 closed PRs? I assume so, but I don't feel I should delete other peoples' branches without asking. |
…13137) I decided to revive this stack: #12227 and merge all of the changes into one PR for slightly easier review and changes. This PR adds a new `AstTypesBitset` struct which is a set of bits that has a fixed size known at compile time and can be used to store AST types as a set. The aim of this structure is to making checks like "does this file have a for statement?" possible to answer without doing any additional iterations over the AST.
…13137) I decided to revive this stack: #12227 and merge all of the changes into one PR for slightly easier review and changes. This PR adds a new `AstTypesBitset` struct which is a set of bits that has a fixed size known at compile time and can be used to store AST types as a set. The aim of this structure is to making checks like "does this file have a for statement?" possible to answer without doing any additional iterations over the AST.

These are not used anywhere yet, but this adds some helper methods to query the AST and see if it contains any nodes of a particular type. Like the previous PR, I'm using the unchecked variants here since it should be safe since the bitset is always sized large enough to contain the biggest value in
AstType.