Skip to content

Commit ff3a818

Browse files
committed
JS: Handle sequence expressions in visitExpression
1 parent 7923926 commit ff3a818

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.semmle.js.ast.Node;
1313
import com.semmle.js.ast.ParenthesizedExpression;
1414
import com.semmle.js.ast.Program;
15+
import com.semmle.js.ast.SequenceExpression;
1516
import com.semmle.js.ast.Statement;
1617
import com.semmle.js.ast.TryStatement;
1718
import com.semmle.js.ast.UnaryExpression;
@@ -88,6 +89,11 @@ protected boolean visitExpression(Expression e) {
8889
if (body instanceof BlockStatement) {
8990
return visitStatement((BlockStatement) body);
9091
}
92+
} else if (e instanceof SequenceExpression) {
93+
SequenceExpression seq = (SequenceExpression) e;
94+
for (Expression child : seq.getExpressions()) {
95+
if (visitExpression(child)) return true;
96+
}
9197
}
9298
return false;
9399
}

javascript/ql/test/library-tests/ModuleTypes/tests.expected

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
| modulePackage/tst.js:1:1:1:75 | <toplevel> | es2015 |
99
| require.js:1:1:7:1 | <toplevel> | node |
1010
| script.js:1:1:1:35 | <toplevel> | non-module |
11-
| toplevel-comma.js:1:1:5:0 | <toplevel> | non-module |
11+
| toplevel-comma.js:1:1:5:0 | <toplevel> | node |

0 commit comments

Comments
 (0)