Skip to content

Commit 984795e

Browse files
committed
fix off-by-one
1 parent 2643ab3 commit 984795e

File tree

3 files changed

+28
-12
lines changed

3 files changed

+28
-12
lines changed

javascript/extractor/src/com/semmle/jcorn/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2709,7 +2709,7 @@ boolean isUsingDecl() {
27092709
m.find(this.pos);
27102710
int next = m.end();
27112711
return !Whitespace.lineBreakG.matcher(inputSubstring(this.pos, next)).matches()
2712-
&& Identifiers.isIdentifierChar(this.input.codePointAt(next + 1), false);
2712+
&& Identifiers.isIdentifierChar(this.input.codePointAt(next), false);
27132713
}
27142714

27152715
/**

javascript/ql/test/library-tests/AST/ExplicitResource/printAst.expected

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ nodes
22
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
33
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
44
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
5+
| file://:0:0:0:0 | (Arguments) | semmle.label | (Arguments) |
56
| file://:0:0:0:0 | (Parameters) | semmle.label | (Parameters) |
67
| tst.js:1:1:10:1 | [FunctionDeclStmt] functio ... } } | semmle.label | [FunctionDeclStmt] functio ... } } |
78
| tst.js:1:1:10:1 | [FunctionDeclStmt] functio ... } } | semmle.order | 1 |
@@ -49,10 +50,10 @@ nodes
4950
| tst.js:20:5:20:23 | [ExprStmt] console.log("end"); | semmle.label | [ExprStmt] console.log("end"); |
5051
| tst.js:20:13:20:15 | [Label] log | semmle.label | [Label] log |
5152
| tst.js:20:17:20:21 | [Literal] "end" | semmle.label | [Literal] "end" |
52-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | semmle.label | [FunctionDeclStmt] functio ... } } |
53-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | semmle.order | 3 |
53+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | semmle.label | [FunctionDeclStmt] functio ... ing); } |
54+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | semmle.order | 3 |
5455
| tst.js:23:10:23:18 | [VarDecl] usesUsing | semmle.label | [VarDecl] usesUsing |
55-
| tst.js:23:22:28:1 | [BlockStmt] { u ... } } | semmle.label | [BlockStmt] { u ... } } |
56+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | semmle.label | [BlockStmt] { u ... ing); } |
5657
| tst.js:24:5:24:9 | [VarRef] using | semmle.label | [VarRef] using |
5758
| tst.js:24:5:24:16 | [CallExpr] using("foo") | semmle.label | [CallExpr] using("foo") |
5859
| tst.js:24:5:24:17 | [ExprStmt] using("foo"); | semmle.label | [ExprStmt] using("foo"); |
@@ -61,13 +62,19 @@ nodes
6162
| tst.js:25:14:25:18 | [VarDecl] using | semmle.label | [VarDecl] using |
6263
| tst.js:25:20:25:22 | [SimpleParameter] foo | semmle.label | [SimpleParameter] foo |
6364
| tst.js:25:25:27:5 | [BlockStmt] { ... . } | semmle.label | [BlockStmt] { ... . } |
65+
| tst.js:28:5:28:9 | [VarRef] using | semmle.label | [VarRef] using |
66+
| tst.js:28:5:28:16 | [CallExpr] using(using) | semmle.label | [CallExpr] using(using) |
67+
| tst.js:28:5:28:17 | [ExprStmt] using(using); | semmle.label | [ExprStmt] using(using); |
68+
| tst.js:28:11:28:15 | [VarRef] using | semmle.label | [VarRef] using |
6469
edges
6570
| file://:0:0:0:0 | (Arguments) | tst.js:4:10:4:18 | [AssignExpr] test = 20 | semmle.label | 0 |
6671
| file://:0:0:0:0 | (Arguments) | tst.js:4:10:4:18 | [AssignExpr] test = 20 | semmle.order | 0 |
6772
| file://:0:0:0:0 | (Arguments) | tst.js:20:17:20:21 | [Literal] "end" | semmle.label | 0 |
6873
| file://:0:0:0:0 | (Arguments) | tst.js:20:17:20:21 | [Literal] "end" | semmle.order | 0 |
6974
| file://:0:0:0:0 | (Arguments) | tst.js:24:11:24:15 | [Literal] "foo" | semmle.label | 0 |
7075
| file://:0:0:0:0 | (Arguments) | tst.js:24:11:24:15 | [Literal] "foo" | semmle.order | 0 |
76+
| file://:0:0:0:0 | (Arguments) | tst.js:28:11:28:15 | [VarRef] using | semmle.label | 0 |
77+
| file://:0:0:0:0 | (Arguments) | tst.js:28:11:28:15 | [VarRef] using | semmle.order | 0 |
7178
| file://:0:0:0:0 | (Parameters) | tst.js:25:20:25:22 | [SimpleParameter] foo | semmle.label | 0 |
7279
| file://:0:0:0:0 | (Parameters) | tst.js:25:20:25:22 | [SimpleParameter] foo | semmle.order | 0 |
7380
| tst.js:1:1:10:1 | [FunctionDeclStmt] functio ... } } | tst.js:1:10:1:10 | [VarDecl] g | semmle.label | 0 |
@@ -154,14 +161,16 @@ edges
154161
| tst.js:20:5:20:22 | [MethodCallExpr] console.log("end") | tst.js:20:5:20:15 | [DotExpr] console.log | semmle.order | 0 |
155162
| tst.js:20:5:20:23 | [ExprStmt] console.log("end"); | tst.js:20:5:20:22 | [MethodCallExpr] console.log("end") | semmle.label | 1 |
156163
| tst.js:20:5:20:23 | [ExprStmt] console.log("end"); | tst.js:20:5:20:22 | [MethodCallExpr] console.log("end") | semmle.order | 1 |
157-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | tst.js:23:10:23:18 | [VarDecl] usesUsing | semmle.label | 0 |
158-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | tst.js:23:10:23:18 | [VarDecl] usesUsing | semmle.order | 0 |
159-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | tst.js:23:22:28:1 | [BlockStmt] { u ... } } | semmle.label | 5 |
160-
| tst.js:23:1:28:1 | [FunctionDeclStmt] functio ... } } | tst.js:23:22:28:1 | [BlockStmt] { u ... } } | semmle.order | 5 |
161-
| tst.js:23:22:28:1 | [BlockStmt] { u ... } } | tst.js:24:5:24:17 | [ExprStmt] using("foo"); | semmle.label | 1 |
162-
| tst.js:23:22:28:1 | [BlockStmt] { u ... } } | tst.js:24:5:24:17 | [ExprStmt] using("foo"); | semmle.order | 1 |
163-
| tst.js:23:22:28:1 | [BlockStmt] { u ... } } | tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | semmle.label | 2 |
164-
| tst.js:23:22:28:1 | [BlockStmt] { u ... } } | tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | semmle.order | 2 |
164+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | tst.js:23:10:23:18 | [VarDecl] usesUsing | semmle.label | 0 |
165+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | tst.js:23:10:23:18 | [VarDecl] usesUsing | semmle.order | 0 |
166+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | semmle.label | 5 |
167+
| tst.js:23:1:29:1 | [FunctionDeclStmt] functio ... ing); } | tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | semmle.order | 5 |
168+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:24:5:24:17 | [ExprStmt] using("foo"); | semmle.label | 1 |
169+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:24:5:24:17 | [ExprStmt] using("foo"); | semmle.order | 1 |
170+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | semmle.label | 2 |
171+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | semmle.order | 2 |
172+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:28:5:28:17 | [ExprStmt] using(using); | semmle.label | 3 |
173+
| tst.js:23:22:29:1 | [BlockStmt] { u ... ing); } | tst.js:28:5:28:17 | [ExprStmt] using(using); | semmle.order | 3 |
165174
| tst.js:24:5:24:16 | [CallExpr] using("foo") | file://:0:0:0:0 | (Arguments) | semmle.label | 1 |
166175
| tst.js:24:5:24:16 | [CallExpr] using("foo") | file://:0:0:0:0 | (Arguments) | semmle.order | 1 |
167176
| tst.js:24:5:24:16 | [CallExpr] using("foo") | tst.js:24:5:24:9 | [VarRef] using | semmle.label | 0 |
@@ -174,5 +183,11 @@ edges
174183
| tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | tst.js:25:14:25:18 | [VarDecl] using | semmle.order | 0 |
175184
| tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | tst.js:25:25:27:5 | [BlockStmt] { ... . } | semmle.label | 5 |
176185
| tst.js:25:5:27:5 | [FunctionDeclStmt] functio ... . } | tst.js:25:25:27:5 | [BlockStmt] { ... . } | semmle.order | 5 |
186+
| tst.js:28:5:28:16 | [CallExpr] using(using) | file://:0:0:0:0 | (Arguments) | semmle.label | 1 |
187+
| tst.js:28:5:28:16 | [CallExpr] using(using) | file://:0:0:0:0 | (Arguments) | semmle.order | 1 |
188+
| tst.js:28:5:28:16 | [CallExpr] using(using) | tst.js:28:5:28:9 | [VarRef] using | semmle.label | 0 |
189+
| tst.js:28:5:28:16 | [CallExpr] using(using) | tst.js:28:5:28:9 | [VarRef] using | semmle.order | 0 |
190+
| tst.js:28:5:28:17 | [ExprStmt] using(using); | tst.js:28:5:28:16 | [CallExpr] using(using) | semmle.label | 1 |
191+
| tst.js:28:5:28:17 | [ExprStmt] using(using); | tst.js:28:5:28:16 | [CallExpr] using(using) | semmle.order | 1 |
177192
graphProperties
178193
| semmle.graphKind | tree |

javascript/ql/test/library-tests/AST/ExplicitResource/tst.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ function usesUsing() {
2525
function using(foo) {
2626
// ...
2727
}
28+
using(using);
2829
}

0 commit comments

Comments
 (0)