Skip to content

Commit 8b277f7

Browse files
authored
Merge pull request github#2868 from asger-semmle/js/missing-await-void
Approved by max-schaefer
2 parents 091c6c0 + 77105f6 commit 8b277f7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

javascript/ql/src/Expressions/MissingAwait.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ predicate isBadPromiseContext(Expr expr) {
4343
or
4444
expr = any(LogicalBinaryExpr e).getLeftOperand()
4545
or
46-
expr = any(UnaryExpr e).getOperand()
46+
exists(UnaryExpr e |
47+
expr = e.getOperand() and
48+
not e instanceof VoidExpr
49+
)
4750
or
4851
expr = any(UpdateExpr e).getOperand()
4952
or

javascript/ql/test/query-tests/Expressions/MissingAwait/tst.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ function useThingPossiblySync(b) {
6161

6262
return thing + "bar"; // NOT OK - but we don't flag it
6363
}
64+
65+
function useThingInVoid() {
66+
void getThing(); // OK
67+
}

0 commit comments

Comments
 (0)