mirror of
https://github.com/github/codeql.git
synced 2025-12-21 11:16:30 +01:00
Replace hasLocationInfo with getLocation in API::Node
This commit is contained in:
@@ -59,3 +59,8 @@ class Location extends @location {
|
|||||||
this.getStartLine() = other.getStartLine() and this.getStartColumn() < other.getStartColumn()
|
this.getStartLine() = other.getStartLine() and this.getStartColumn() < other.getStartColumn()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** An entity representing an empty location. */
|
||||||
|
class EmptyLocation extends Location {
|
||||||
|
EmptyLocation() { this.hasLocationInfo("", 0, 0, 0, 0) }
|
||||||
|
}
|
||||||
|
|||||||
@@ -140,26 +140,14 @@ module API {
|
|||||||
*/
|
*/
|
||||||
DataFlow::Node getInducingNode() { this = Impl::MkUse(result) }
|
DataFlow::Node getInducingNode() { this = Impl::MkUse(result) }
|
||||||
|
|
||||||
/**
|
/** Gets the location of this node. */
|
||||||
* Holds if this element is at the specified location.
|
Location getLocation() {
|
||||||
* The location spans column `startcolumn` of line `startline` to
|
result = this.getInducingNode().getLocation()
|
||||||
* column `endcolumn` of line `endline` in file `filepath`.
|
|
||||||
* For more information, see
|
|
||||||
* [Locations](https://help.semmle.com/QL/learn-ql/locations.html).
|
|
||||||
*/
|
|
||||||
predicate hasLocationInfo(
|
|
||||||
string filepath, int startline, int startcolumn, int endline, int endcolumn
|
|
||||||
) {
|
|
||||||
getInducingNode().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
|
||||||
or
|
or
|
||||||
// For nodes that do not have a meaningful location, `path` is the empty string and all other
|
// For nodes that do not have a meaningful location, `path` is the empty string and all other
|
||||||
// parameters are zero.
|
// parameters are zero.
|
||||||
not exists(getInducingNode()) and
|
not exists(getInducingNode()) and
|
||||||
filepath = "" and
|
result instanceof EmptyLocation
|
||||||
startline = 0 and
|
|
||||||
startcolumn = 0 and
|
|
||||||
endline = 0 and
|
|
||||||
endcolumn = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user