mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Tree-sitter: Emit empty_location relation to avoid scan
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
"/*- Yaml dbscheme -*/",
|
"/*- Yaml dbscheme -*/",
|
||||||
"/*- Blame dbscheme -*/",
|
"/*- Blame dbscheme -*/",
|
||||||
"/*- JSON dbscheme -*/",
|
"/*- JSON dbscheme -*/",
|
||||||
"/*- Python dbscheme -*/"
|
"/*- Python dbscheme -*/",
|
||||||
|
"/*- Empty location -*/"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,12 @@ containerparent(
|
|||||||
unique int child: @container ref
|
unique int child: @container ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Empty location -*/
|
||||||
|
|
||||||
|
empty_location(
|
||||||
|
int location: @location_default ref
|
||||||
|
);
|
||||||
|
|
||||||
/*- Source location prefix -*/
|
/*- Source location prefix -*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -64,5 +64,5 @@ class Location extends @location_default {
|
|||||||
|
|
||||||
/** An entity representing an empty location. */
|
/** An entity representing an empty location. */
|
||||||
class EmptyLocation extends 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
|
unique int child: @container ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Empty location -*/
|
||||||
|
|
||||||
|
empty_location(
|
||||||
|
int location: @location_default ref
|
||||||
|
);
|
||||||
|
|
||||||
/*- Source location prefix -*/
|
/*- Source location prefix -*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ fn populate_empty_file(writer: &mut trap::Writer) -> trap::Label {
|
|||||||
|
|
||||||
pub fn populate_empty_location(writer: &mut trap::Writer) {
|
pub fn populate_empty_location(writer: &mut trap::Writer) {
|
||||||
let file_label = populate_empty_file(writer);
|
let file_label = populate_empty_file(writer);
|
||||||
global_location(
|
let loc_label = global_location(
|
||||||
writer,
|
writer,
|
||||||
file_label,
|
file_label,
|
||||||
trap::Location {
|
trap::Location {
|
||||||
@@ -85,6 +85,7 @@ pub fn populate_empty_location(writer: &mut trap::Writer) {
|
|||||||
end_column: 0,
|
end_column: 0,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
writer.add_tuple("empty_location", vec![trap::Arg::Label(loc_label)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn populate_parent_folders(
|
pub fn populate_parent_folders(
|
||||||
|
|||||||
@@ -33,6 +33,12 @@ containerparent(
|
|||||||
unique int child: @container ref
|
unique int child: @container ref
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/*- Empty location -*/
|
||||||
|
|
||||||
|
empty_location(
|
||||||
|
int location: @location_default ref
|
||||||
|
);
|
||||||
|
|
||||||
/*- Source location prefix -*/
|
/*- Source location prefix -*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user