Skip to content

Commit

Permalink
JS: Handle sequence expressions in visitExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
asgerf committed Nov 11, 2024
1 parent e534a42 commit a243efb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.semmle.js.ast.Node;
import com.semmle.js.ast.ParenthesizedExpression;
import com.semmle.js.ast.Program;
import com.semmle.js.ast.SequenceExpression;
import com.semmle.js.ast.Statement;
import com.semmle.js.ast.TryStatement;
import com.semmle.js.ast.UnaryExpression;
Expand Down Expand Up @@ -88,6 +89,11 @@ protected boolean visitExpression(Expression e) {
if (body instanceof BlockStatement) {
return visitStatement((BlockStatement) body);
}
} else if (e instanceof SequenceExpression) {
SequenceExpression seq = (SequenceExpression) e;
for (Expression child : seq.getExpressions()) {
if (visitExpression(child)) return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
| modulePackage/tst.js:1:1:1:75 | <toplevel> | es2015 |
| require.js:1:1:7:1 | <toplevel> | node |
| script.js:1:1:1:35 | <toplevel> | non-module |
| toplevel-comma.js:1:1:5:0 | <toplevel> | non-module |
| toplevel-comma.js:1:1:5:0 | <toplevel> | node |

0 comments on commit a243efb

Please sign in to comment.