Skip to content

Commit 338990b

Browse files
committed
Rust: Remove getMethodName from Call
1 parent f327801 commit 338990b

File tree

2 files changed

+1
-14
lines changed

2 files changed

+1
-14
lines changed

rust/ql/lib/codeql/rust/elements/internal/CallImpl.qll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ module Impl {
3434
* called in Rust.
3535
*/
3636
abstract class Call extends ExprImpl::Expr {
37-
/** Gets the name of the method called if this call is a method call. */
38-
abstract string getMethodName();
39-
4037
/** Gets the argument at the given position, if any. */
4138
abstract Expr getArgument(ArgumentPosition pos);
4239

@@ -87,8 +84,6 @@ module Impl {
8784
class CallExprCall extends Call instanceof CallExpr {
8885
CallExprCall() { not callIsMethodCall(this, _, _, _) }
8986

90-
override string getMethodName() { none() }
91-
9287
override Expr getArgument(ArgumentPosition pos) {
9388
result = super.getArgList().getArg(pos.asPosition())
9489
}
@@ -107,8 +102,6 @@ module Impl {
107102
*/
108103
predicate hasExplicitSelfBorrow() { selfIsRef = true }
109104

110-
override string getMethodName() { result = methodName }
111-
112105
override Expr getArgument(ArgumentPosition pos) {
113106
pos.isSelf() and result = super.getArgList().getArg(0)
114107
or
@@ -117,8 +110,6 @@ module Impl {
117110
}
118111

119112
private class MethodCallExprCall extends Call instanceof MethodCallExpr {
120-
override string getMethodName() { result = super.getIdentifier().getText() }
121-
122113
override Expr getArgument(ArgumentPosition pos) {
123114
pos.isSelf() and result = this.(MethodCallExpr).getReceiver()
124115
or
@@ -133,8 +124,6 @@ module Impl {
133124

134125
OperatorCall() { super.isOverloaded(trait, methodName, borrows) }
135126

136-
override string getMethodName() { result = methodName }
137-
138127
override Expr getArgument(ArgumentPosition pos) {
139128
pos.isSelf() and result = super.getOperand(0)
140129
or
@@ -143,8 +132,6 @@ module Impl {
143132
}
144133

145134
private class IndexCall extends Call instanceof IndexExpr {
146-
override string getMethodName() { result = "index" }
147-
148135
override Expr getArgument(ArgumentPosition pos) {
149136
pos.isSelf() and result = super.getBase()
150137
or

rust/ql/lib/codeql/rust/internal/TypeInference.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ private module MethodResolution {
17101710
final class MethodCallOperation extends MethodCall, Operation {
17111711
pragma[nomagic]
17121712
override predicate hasNameAndArity(string name, int arity) {
1713-
name = this.(Call).getMethodName() and
1713+
this.isOverloaded(_, name, _) and
17141714
arity = this.getNumberOfOperands() - 1
17151715
}
17161716

0 commit comments

Comments
 (0)