-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Rust: add Callable::getParam and CallExprBase::getArg shortcuts
#19708
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds helper shortcuts and corresponding CodeQL implementations to simplify accessing function parameters and call arguments in the Rust AST.
- Introduces synthetic
paramsandargsfields in the schema forCallableandCallExprBase, respectively. - Implements
getParamandgetArgoverrides in the CodeQL internal modules. - Updates imports, linguist settings, and generated file lists to wire in new extractor tests.
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| rust/schema/prelude.py | Add synthetic params field to Callable |
| rust/schema/annotations.py | Add synthetic args field to CallExprBase |
| rust/ql/lib/codeql/rust/elements/internal/CallableImpl.qll | Implement getParam(index) override |
| rust/ql/lib/codeql/rust/elements/internal/CallExprBaseImpl.qll | Implement getArg(index) override |
| rust/ql/lib/codeql/rust/elements/Callable.qll | Import Param to support getParam |
| rust/ql/.gitattributes | Adjust linguist-generated entries, add new tests |
| rust/ql/.generated.list | Update checksums and include new generated files |
Comments suppressed due to low confidence (4)
rust/schema/prelude.py:76
- [nitpick] Add a docstring entry in the class-level comment to describe the purpose of the synthetic
paramsfield.
params: list["Param"] | synth
rust/schema/annotations.py:229
- [nitpick] Include a docstring entry explaining the synthetic
argsfield in theCallExprBaseclass doc.
args: list["Expr"] | synth
rust/ql/lib/codeql/rust/elements/internal/CallableImpl.qll:19
- [nitpick] Add a QLdoc comment above
getParamdescribing its behavior (retrieves the parameter at the given index) and its return type.
override Param getParam(int index) { result = this.getParamList().getParam(index) }
rust/ql/lib/codeql/rust/elements/internal/CallExprBaseImpl.qll:32
- [nitpick] Add a QLdoc comment above
getArgexplaining that it returns the call argument at the specified index.
override Expr getArg(int index) { result = this.getArgList().getArg(index) }
| private import internal.CallableImpl | ||
| import codeql.rust.elements.AstNode | ||
| import codeql.rust.elements.Attr | ||
| import codeql.rust.elements.Param |
Check warning
Code scanning / CodeQL
Redundant import Warning
codeql.rust.elements.ParamList
| private import codeql.rust.elements.internal.generated.Raw | ||
| import codeql.rust.elements.ArgList | ||
| import codeql.rust.elements.Attr | ||
| import codeql.rust.elements.Expr |
Check warning
Code scanning / CodeQL
Redundant import Warning generated
codeql.rust.elements.ArgList
| private import codeql.rust.elements.internal.generated.Raw | ||
| import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl | ||
| import codeql.rust.elements.Attr | ||
| import codeql.rust.elements.Param |
Check warning
Code scanning / CodeQL
Redundant import Warning generated
codeql.rust.elements.ParamList
|
language test failure is not relevant for this PR, and is being addressed here |
No description provided.