Skip to content

Commit a7628e7

Browse files
committed
Rust: revert unnecessary changes to VariableImpl.qll
1 parent 2d07270 commit a7628e7

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

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

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,6 @@ module Impl {
160160
string toString() { result = name_ }
161161

162162
string getName() { result = name_ }
163-
164-
predicate hasLocationInfo(
165-
string filepath, int startline, int startcolumn, int endline, int endcolumn
166-
) {
167-
this.(PathExpr)
168-
.getLocation()
169-
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) or
170-
this.(FormatTemplateVariableAccess)
171-
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
172-
}
173163
}
174164

175165
private AstNode getAnAncestorInVariableScope(AstNode n) {
@@ -290,7 +280,7 @@ module Impl {
290280
) {
291281
name = cand.getName() and
292282
scope = [cand.(VariableScope), getEnclosingScope(cand)] and
293-
cand.hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
283+
cand.getLocation().hasLocationInfo(_, startline, startcolumn, endline, endcolumn) and
294284
nestLevel = 0
295285
or
296286
exists(VariableScope inner |
@@ -365,14 +355,8 @@ module Impl {
365355
result = this.asVariable().toString() or result = this.asVariableAccessCand().toString()
366356
}
367357

368-
predicate hasLocationInfo(
369-
string filepath, int startline, int startcolumn, int endline, int endcolumn
370-
) {
371-
this.asVariable()
372-
.getLocation()
373-
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) or
374-
this.asVariableAccessCand()
375-
.hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
358+
Location getLocation() {
359+
result = this.asVariable().getLocation() or result = this.asVariableAccessCand().getLocation()
376360
}
377361

378362
pragma[nomagic]
@@ -445,8 +429,6 @@ module Impl {
445429
)
446430
}
447431

448-
private import codeql.rust.elements.internal.generated.Synth
449-
450432
/** A variable access. */
451433
class VariableAccess extends PathExprBaseImpl::PathExprBase instanceof VariableAccessCand {
452434
private string name;

0 commit comments

Comments
 (0)