Skip to content

Commit 96e47fc

Browse files
committed
C#: Adjust the location of the empty element.
1 parent eba37a7 commit 96e47fc

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,20 @@ class Location extends @location {
7474
}
7575

7676
/** An empty location. */
77-
class EmptyLocation extends Location {
78-
EmptyLocation() { this.hasLocationInfo("", -1, -1, -1, -1) }
77+
class EmptyLocation extends SourceLocation {
78+
EmptyLocation() { locations_default(this, _, -1, -1, -1, -1) }
79+
80+
override predicate hasLocationInfo(
81+
string filepath, int startline, int startcolumn, int endline, int endcolumn
82+
) {
83+
filepath = "" and
84+
startline = 0 and
85+
startcolumn = 0 and
86+
endline = 0 and
87+
endcolumn = 0
88+
}
89+
90+
override string toString() { result = "empty location" }
7991
}
8092

8193
/**

0 commit comments

Comments
 (0)