Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BreakExprTargetChildMapping extends ParentAstNode, Expr {
}

class CallExprBaseChildMapping extends ParentAstNode, CallExprBase {
override predicate relevantChild(AstNode child) { child = this.getArgList().getAnArg() }
override predicate relevantChild(AstNode child) { child = this.getAnArg() }
}

class StructExprChildMapping extends ParentAstNode, StructExpr {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class CallableScopeTree extends StandardTree, PreOrderTree, PostOrderTree, Scope
i = 0 and
result = this.getParamList().getSelfParam()
or
result = this.getParamList().getParam(i - 1)
result = this.getParam(i - 1)
or
i = this.getParamList().getNumberOfParams() + 1 and
result = this.getBody()
Expand Down Expand Up @@ -543,7 +543,7 @@ module ExprTrees {

class MethodCallExprTree extends StandardPostOrderTree, MethodCallExpr {
override AstNode getChildNode(int i) {
if i = 0 then result = this.getReceiver() else result = this.getArgList().getArg(i - 1)
if i = 0 then result = this.getReceiver() else result = this.getArg(i - 1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module Impl {
pragma[nomagic]
private PathResolution::ItemNode getResolvedFunctionAndPos(int pos) {
result = getResolvedFunction(this) and
exists(this.getArgList().getArg(pos))
exists(this.getArg(pos))
}

/**
Expand Down
4 changes: 2 additions & 2 deletions rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ module Impl {
not text.charAt(0).isUppercase() and
// exclude parameters from functions without a body as these are trait method declarations
// without implementations
not exists(Function f | not f.hasBody() and f.getParamList().getAParam().getPat() = pat) and
not exists(Function f | not f.hasBody() and f.getAParam().getPat() = pat) and
// exclude parameters from function pointer types (e.g. `x` in `fn(x: i32) -> i32`)
not exists(FnPtrTypeRepr fp | fp.getParamList().getParam(_).getPat() = pat)
not exists(FnPtrTypeRepr fp | fp.getParamList().getAParam().getPat() = pat)
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] For consistency with other modules, call fp.getAParam() directly instead of via getParamList(). This matches how Function.getAParam() is used above.

Suggested change
not exists(FnPtrTypeRepr fp | fp.getParamList().getAParam().getPat() = pat)
not exists(FnPtrTypeRepr fp | fp.getAParam().getPat() = pat)

Copilot uses AI. Check for mistakes.
)
}

Expand Down
2 changes: 1 addition & 1 deletion rust/ql/lib/codeql/rust/internal/Type.qll
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ class SelfTypeParameter extends TypeParameter, TSelfTypeParameter {
class ImplTraitTypeTypeParameter extends ImplTraitType, TypeParameter {
private Function function;

ImplTraitTypeTypeParameter() { impl = function.getParamList().getAParam().getTypeRepr() }
ImplTraitTypeTypeParameter() { impl = function.getAParam().getTypeRepr() }

override Function getFunction() { result = function }

Expand Down
4 changes: 2 additions & 2 deletions rust/ql/lib/codeql/rust/internal/TypeInference.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ private module AwaitExprMatchingInput implements MatchingInputSig {

Type getDeclaredType(DeclarationPosition dpos, TypePath path) {
dpos.isSelf() and
result = this.getParamList().getParam(0).getTypeRepr().(TypeMention).resolveTypeAt(path)
result = this.getParam(0).getTypeRepr().(TypeMention).resolveTypeAt(path)
or
dpos.isOutput() and
result = this.getRetType().getTypeRepr().(TypeMention).resolveTypeAt(path)
Expand Down Expand Up @@ -1199,7 +1199,7 @@ private module MethodCall {
Expr receiver;

CallExprMethodCall() {
receiver = this.getArgList().getArg(0) and
receiver = this.getArg(0) and
exists(Path path, Function f |
path = this.getFunction().(PathExpr).getPath() and
f = resolvePath(path) and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module ModelGeneratorCommonInput implements

bindingset[c]
string paramReturnNodeAsExactOutput(Callable c, DataFlowImpl::ParameterPosition pos) {
result = parameterExactAccess(c.getParamList().getParam(pos.getPosition()))
result = parameterExactAccess(c.getParam(pos.getPosition()))
or
pos.isSelf() and result = qualifierString()
}
Expand Down