mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
Merge pull request #16597 from hvitved/tree-sitter/empty-location
Tree-sitter: Emit `empty_location` relation to avoid scan
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Remove `empty_location` relation
|
||||
compatibility: backwards
|
||||
empty_location.rel: delete
|
||||
@@ -64,5 +64,5 @@ class Location extends @location_default {
|
||||
|
||||
/** An entity representing an empty location. */
|
||||
class EmptyLocation extends Location {
|
||||
EmptyLocation() { this.hasLocationInfo("", 0, 0, 0, 0) }
|
||||
EmptyLocation() { empty_location(this) }
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ containerparent(
|
||||
unique int child: @container ref
|
||||
);
|
||||
|
||||
/*- Empty location -*/
|
||||
|
||||
empty_location(
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
/*- Source location prefix -*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
class EmptyFile extends @file {
|
||||
EmptyFile() { files(this, "") }
|
||||
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from EmptyFile f, Location l
|
||||
where locations_default(l, f, 0, 0, 0, 0)
|
||||
select l
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Add `empty_location` relation
|
||||
compatibility: backwards
|
||||
empty_location.rel: run empty_location.qlo
|
||||
Reference in New Issue
Block a user