Skip to content

Commit 2cd92ef

Browse files
committed
JS: Update API usage in MissingAwait
1 parent 7502769 commit 2cd92ef

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

javascript/ql/lib/semmle/javascript/internal/BindingInfo.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ class TypeNameBindingNode extends NameResolution::Node {
132132
* and enums and enum members have this property.
133133
*/
134134
predicate isSanitizingPrimitiveType() { TypeResolution::isSanitizingPrimitiveType(this) }
135+
136+
/**
137+
* Holds if the given type is a Promise object. Does not hold for unions unless all parts of the union are promises.
138+
*/
139+
predicate isPromiseType() { TypeResolution::isPromiseType(this) }
135140
}
136141

137142
/**

javascript/ql/src/Expressions/MissingAwait.ql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
*/
1111

1212
import javascript
13-
private import semmle.javascript.internal.TypeResolution
1413

1514
/**
1615
* Holds if `call` is a call to an `async` function.
@@ -29,7 +28,7 @@ predicate isPromise(DataFlow::SourceNode node, boolean nullable) {
2928
isAsyncCall(node, nullable)
3029
or
3130
not isAsyncCall(node, _) and
32-
TypeResolution::valueHasPromiseType(node.asExpr()) and
31+
node.asExpr().getTypeBinding().isPromiseType() and
3332
nullable = true
3433
}
3534

0 commit comments

Comments
 (0)