Skip to content

Commit d6c3ae2

Browse files
author
Max Schaefer
committed
JavaScript: Fix bug in extraction of next_token.
1 parent ea429f4 commit d6c3ae2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void extractTokens(Label toplevelKey) {
133133
locationManager.emitNodeLocation(token, key);
134134

135135
// fill in next_token relation
136-
while (j < comments.size() && comments.get(j).getLoc().getEnd().compareTo(token.getLoc().getStart()) < 0)
136+
while (j < comments.size() && comments.get(j).getLoc().getEnd().compareTo(token.getLoc().getStart()) <= 0)
137137
trapwriter.addTuple("next_token", this.trapwriter.localID(comments.get(j++)), key);
138138

139139
// the parser sometimes duplicates tokens; skip the second one by nulling it out

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class Main {
4141
* such a way that it may produce different tuples for the same file under the same
4242
* {@link ExtractorConfig}.
4343
*/
44-
public static final String EXTRACTOR_VERSION = "2019-01-17";
44+
public static final String EXTRACTOR_VERSION = "2019-01-29";
4545

4646
public static final Pattern NEWLINE = Pattern.compile("\n");
4747

javascript/ql/test/library-tests/Comments/next_token.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
| comments.js:3:7:3:29 | <!-- HT ... t start | comments.js:7:10:7:17 | function |
44
| comments.js:4:1:4:18 | /** doc comment */ | comments.js:7:10:7:17 | function |
55
| comments.js:5:1:5:20 | --> HTML comment end | comments.js:7:10:7:17 | function |
6-
| comments.js:7:1:7:9 | /*start*/ | comments.js:7:19:7:19 | f |
7-
| comments.js:7:24:7:30 | /*end*/ | comments.js:8:1:8:0 | |
6+
| comments.js:7:1:7:9 | /*start*/ | comments.js:7:10:7:17 | function |
7+
| comments.js:7:24:7:30 | /*end*/ | comments.js:7:31:7:31 | } |

0 commit comments

Comments
 (0)