Merge pull request #16597 from hvitved/tree-sitter/empty-location

Tree-sitter: Emit `empty_location` relation to avoid scan
This commit is contained in:
Tom Hvitved
2024-05-27 15:19:15 +02:00
committed by GitHub
13 changed files with 6106 additions and 3 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Remove `empty_location` relation
compatibility: backwards
empty_location.rel: delete

View File

@@ -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) }
}

View File

@@ -36,6 +36,12 @@ containerparent(
unique int child: @container ref
);
/*- Empty location -*/
empty_location(
int location: @location_default ref
);
/*- Source location prefix -*/
/**

View File

@@ -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

View File

@@ -0,0 +1,3 @@
description: Add `empty_location` relation
compatibility: backwards
empty_location.rel: run empty_location.qlo