Skip to content

Commit 676da02

Browse files
authored
Merge pull request github#3192 from asger-semmle/js/missing-await-not-delete
Approved by esbena
2 parents 16c7a35 + 3a9d047 commit 676da02

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

javascript/ql/src/Expressions/MissingAwait.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ predicate isBadPromiseContext(Expr expr) {
4545
or
4646
exists(UnaryExpr e |
4747
expr = e.getOperand() and
48-
not e instanceof VoidExpr
48+
not e instanceof VoidExpr and
49+
not e instanceof DeleteExpr
4950
)
5051
or
5152
expr = any(UpdateExpr e).getOperand()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
declare let cache: { [x: string]: Promise<any> };
2+
3+
function deleteCache(x: string) {
4+
delete cache[x]; // OK
5+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"include": ["."]
3+
}

0 commit comments

Comments
 (0)