Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b2acb7d

Browse files
committed
Add a consistency query
1 parent 03d5646 commit b2acb7d

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java
2+
3+
// Locations should either be :0:0:0:0 locations (UnknownLocation, or
4+
// a whole file), or all 4 fields should be positive.
5+
Location badLocation() {
6+
[result.getStartLine(), result.getEndLine(), result.getStartColumn(), result.getEndColumn()] != 0 and
7+
[result.getStartLine(), result.getEndLine(), result.getStartColumn(), result.getEndColumn()] < 1
8+
}
9+
10+
// The start should not be after the end.
11+
Location backwardsLocation() {
12+
result.getStartLine() > result.getEndLine()
13+
or
14+
result.getStartLine() = result.getEndLine() and
15+
result.getStartColumn() > result.getEndColumn()
16+
}
17+
18+
from Location l
19+
where l = badLocation() or l = backwardsLocation()
20+
select l
21+

0 commit comments

Comments
 (0)