Skip to content

Commit 8812f26

Browse files
committed
C#: Address review comments
1 parent 0211837 commit 8812f26

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

csharp/ql/src/Useless code/DefaultToString.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DefaultToStringType extends ValueOrRefType {
7272
result instanceof SourceLocation
7373
or
7474
not super.getLocation() instanceof SourceLocation and
75-
result.hasLocationInfo("", 0, 0, 0, 0)
75+
result instanceof EmptyLocation
7676
}
7777
}
7878

csharp/ql/src/semmle/code/csharp/ExprOrStmtParent.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ module ExprOrStmtParentCached {
372372
result = min(Location l | l = e.getALocation() | l order by l.getFile().toString())
373373
or
374374
not exists(e.getALocation()) and
375-
result.hasLocationInfo("", 0, 0, 0, 0)
375+
result instanceof EmptyLocation
376376
}
377377
}
378378
private import ExprOrStmtParentCached

csharp/ql/src/semmle/code/csharp/Location.qll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ class Location extends @location {
5151
final int getEndColumn() { this.hasLocationInfo(_, _, _, _, result) }
5252
}
5353

54+
/** An empty location. */
55+
class EmptyLocation extends Location { EmptyLocation() { this.hasLocationInfo("", 0, 0, 0, 0) } }
56+
5457
/**
5558
* A location in source code, comprising of a source file and a segment of text
5659
* within the file.

0 commit comments

Comments
 (0)