Skip to content

Commit eba37a7

Browse files
committed
Experiment with simpler EmptyLocation.
1 parent 7b1f9f1 commit eba37a7

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

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

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

7676
/** An empty location. */
77-
class EmptyLocation extends Location, @location_default {
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" }
77+
class EmptyLocation extends Location {
78+
EmptyLocation() { this.hasLocationInfo("", -1, -1, -1, -1) }
9179
}
9280

9381
/**
9482
* A location in source code, comprising of a source file and a segment of text
9583
* within the file.
9684
*/
9785
class SourceLocation extends Location, @location_default {
98-
SourceLocation() { not this instanceof EmptyLocation }
99-
10086
/** Gets the location that takes into account `#line` directives, if any. */
10187
SourceLocation getMappedLocation() {
10288
locations_mapped(this, result) and

0 commit comments

Comments
 (0)