Skip to content

Commit 9a00f4d

Browse files
author
Max Schaefer
committed
JavaScript: store YAML locations in yaml_locations table instead of hasLocation.
1 parent 37cb4e4 commit 9a00f4d

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

javascript/extractor/src/com/semmle/js/extractor/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Main {
3737
* A version identifier that should be updated every time the extractor changes in such a way that
3838
* it may produce different tuples for the same file under the same {@link ExtractorConfig}.
3939
*/
40-
public static final String EXTRACTOR_VERSION = "2019-07-24";
40+
public static final String EXTRACTOR_VERSION = "2019-07-25";
4141

4242
public static final Pattern NEWLINE = Pattern.compile("\n");
4343

javascript/extractor/src/com/semmle/js/extractor/YAMLExtractor.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public LoCInfo extract(TextualExtractor textualExtractor) {
9999
trapWriter = textualExtractor.getTrapwriter();
100100

101101
Label fileLabel = locationManager.getFileLabel();
102+
locationManager.setHasLocationTable("yaml_locations");
102103
try {
103104
parser = new ParserImpl(new StreamReader(textualExtractor.getSource()));
104105
resolver = new Resolver();

javascript/ql/src/semmle/javascript/YAML.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import javascript
1313
* referring to some other YAML value.
1414
*/
1515
class YAMLNode extends @yaml_node, Locatable {
16-
override Location getLocation() { hasLocation(this, result) }
16+
override Location getLocation() { yaml_locations(this, result) }
1717

1818
/**
1919
* Gets the parent node of this node, which is always a collection.
@@ -300,6 +300,8 @@ class YAMLDocument extends YAMLNode {
300300
* An error message produced by the YAML parser while processing a YAML file.
301301
*/
302302
class YAMLParseError extends @yaml_error, Error {
303+
override Location getLocation() { yaml_locations(this, result) }
304+
303305
override string getMessage() { yaml_errors(this, result) }
304306

305307
override string toString() { result = getMessage() }

javascript/ql/src/semmlecode.javascript.dbscheme

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@ case @json_value.kind of
933933
| @token
934934
| @cfg_node
935935
| @jsdoc | @jsdoc_type_expr | @jsdoc_tag
936-
| @yaml_node | @yaml_error
936+
| @yaml_locatable
937937
| @xmllocatable;
938938

939939
hasLocation (unique int locatable: @locatable ref,
@@ -1027,6 +1027,11 @@ yaml_scalars (unique int scalar: @yaml_scalar_node ref,
10271027
yaml_errors (unique int id: @yaml_error,
10281028
varchar(900) message: string ref);
10291029

1030+
yaml_locations(unique int locatable: @yaml_locatable ref,
1031+
int ___location: @location_default ref);
1032+
1033+
@yaml_locatable = @yaml_node | @yaml_error;
1034+
10301035
/* XML Files */
10311036

10321037
xmlEncoding(

0 commit comments

Comments
 (0)