mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
JS: Switch from hasLocationInfo to Location
This commit is contained in:
@@ -501,16 +501,25 @@ module API {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the location of this API node, if it corresponds to a program element with a source location.
|
||||
*/
|
||||
final Location getLocation() { result = this.getInducingNode().getLocation() }
|
||||
|
||||
/**
|
||||
* DEPRECATED: Use `getLocation().hasLocationInfo()` instead.
|
||||
*
|
||||
* Holds if this node is located in file `path` between line `startline`, column `startcol`,
|
||||
* and line `endline`, column `endcol`.
|
||||
*
|
||||
* For nodes that do not have a meaningful location, `path` is the empty string and all other
|
||||
* parameters are zero.
|
||||
*/
|
||||
predicate hasLocationInfo(string path, int startline, int startcol, int endline, int endcol) {
|
||||
this.getInducingNode().hasLocationInfo(path, startline, startcol, endline, endcol)
|
||||
deprecated predicate hasLocationInfo(
|
||||
string path, int startline, int startcol, int endline, int endcol
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(path, startline, startcol, endline, endcol)
|
||||
or
|
||||
not exists(this.getInducingNode()) and
|
||||
not exists(this.getLocation()) and
|
||||
path = "" and
|
||||
startline = 0 and
|
||||
startcol = 0 and
|
||||
|
||||
@@ -88,7 +88,7 @@ module ModelExport<ModelExportSig S> {
|
||||
private import codeql.mad.dynamic.GraphExport
|
||||
private import internal.ApiGraphModelsExport
|
||||
|
||||
private module GraphExportConfig implements GraphExportSig<API::Node> {
|
||||
private module GraphExportConfig implements GraphExportSig<Location, API::Node> {
|
||||
predicate edge = Specific::apiGraphHasEdge/3;
|
||||
|
||||
predicate shouldContain = S::shouldContain/1;
|
||||
|
||||
@@ -65,7 +65,9 @@ signature predicate shouldContainTypeSig(string type);
|
||||
* Notice that the access path `Member[blah].Member[z]` consists of an access path generated from the API
|
||||
* graph, with pieces of the access path from the original type model appended to it.
|
||||
*/
|
||||
module TypeGraphExport<GraphExportSig<API::Node> S, shouldContainTypeSig/1 shouldContainType> {
|
||||
module TypeGraphExport<
|
||||
GraphExportSig<Specific::Location, API::Node> S, shouldContainTypeSig/1 shouldContainType>
|
||||
{
|
||||
/** Like `shouldContainType` but includes types that lead to `type` via type models. */
|
||||
private predicate shouldContainTypeEx(string type) {
|
||||
shouldContainType(type)
|
||||
@@ -76,7 +78,7 @@ module TypeGraphExport<GraphExportSig<API::Node> S, shouldContainTypeSig/1 shoul
|
||||
)
|
||||
}
|
||||
|
||||
private module Config implements GraphExportSig<API::Node> {
|
||||
private module Config implements GraphExportSig<Specific::Location, API::Node> {
|
||||
import S
|
||||
|
||||
predicate shouldContain(API::Node node) {
|
||||
@@ -93,7 +95,7 @@ module TypeGraphExport<GraphExportSig<API::Node> S, shouldContainTypeSig/1 shoul
|
||||
}
|
||||
}
|
||||
|
||||
private module ExportedGraph = GraphExport<API::Node, Config>;
|
||||
private module ExportedGraph = GraphExport<Specific::Location, API::Node, Config>;
|
||||
|
||||
import ExportedGraph
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ module API = JS::API;
|
||||
|
||||
import JS::DataFlow as DataFlow
|
||||
|
||||
class Location = JS::Location;
|
||||
|
||||
/**
|
||||
* Holds if `rawType` represents the JavaScript type `qualifiedName` from the given NPM `package`.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user