Repository navigation
Conversation
…rations." This reverts commit d456656.
…tes" This reverts commit da77b35.
Will un-revert once the new mechanism is in place. This reverts commit 04865cb.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit 4a60ad0.
|
|
||
| /** Gets the node corresponding to the field `parameter`. */ | ||
| final F::Parameter getParameter(int i) { | ||
| final override F::Parameter getParameter(int i) { |
| F::Block getBody() { none() } | ||
|
|
||
| /** Gets the node corresponding to the field `parameter`. */ | ||
| F::Parameter getParameter(int i) { none() } |
|
|
||
| /** Gets the node corresponding to the field `parameter`. */ | ||
| final F::Parameter getParameter(int i) { | ||
| final override F::Parameter getParameter(int i) { |
|
|
||
| /** Gets the node corresponding to the field `parameter`. */ | ||
| final F::Parameter getParameter(int i) { | ||
| final override F::Parameter getParameter(int i) { |
|
|
||
| /** Gets the node corresponding to the field `parameter`. */ | ||
| final F::Parameter getParameter(int i) { unified_function_expr_parameter(this, i, result) } | ||
| final override F::Parameter getParameter(int i) { |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Tests do not cover omitted fields or covariant getter types, despite these being core supported scenarios.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Adds explicitly declared fields to AST supertypes and generates callable getter APIs.
Changes:
- Supports detailed supertype declarations with fields.
- Generates default supertype getters and concrete overrides.
- Adds schema conversion and generator tests.
| File | Description |
|---|---|
unified/ql/lib/codeql/unified/internal/Ast.qll |
Updates generated callable getters. |
unified/extractor/ast_types.yml |
Declares callable fields. |
shared/yeast-schema/src/node_types_yaml.rs |
Parses and serializes supertype fields. |
shared/tree-sitter-extractor/src/node_types.rs |
Preserves fields on union entries. |
shared/tree-sitter-extractor/src/generator/ql.rs |
Removes abstract predicate-body representation. |
shared/tree-sitter-extractor/src/generator/ql_gen.rs |
Generates supertype getters and overrides. |
shared/tree-sitter-extractor/src/generator/mod.rs |
Handles expanded union entries. |
shared/tree-sitter-extractor/src/extractor/mod.rs |
Handles expanded union entries during matching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| let yaml = r#" | ||
| supertypes: | ||
| callable: | ||
| subtypes: [function] |
There was a problem hiding this comment.
I think we can live with this
Rerun has been triggered: 4 restarted 🚀 |
tausbn
left a comment
There was a problem hiding this comment.
This looks good to me. Just to double-check: I assume you regenerated the AST QL files for all of the other relevant languages and that there were no changes?
(I'm thinking there shouldn't be any changes, since "normal" node types don't have any knowledge of exposed fields, but I just wanted to make sure.)

Supertypes in
ast_nodes.ymlcan now have a list of fields to expose in the generated QL class.This replaces the previous rule from #22507 where fields that were common among all subtypes were automatically hoisted to supertypes. The first couple of commits revert the changes from that PR, mainly to make things easier to review and avoid leaving behind weird bits of legacy code.
Compared to automatic hoisting, manually-declared supertype fields work better in a few scenarios:
This PR uses the feature for the
callablesupertype:Previously the
bodyfield was hoisted automatically, but notparameter,because some callables can't have parameters (like top-level).