Skip to content

Commit fcb6882

Browse files
committed
JS: Update API usage in MissingAwait
1 parent e459884 commit fcb6882

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
@@ -11,7 +11,6 @@
1111
*/
1212

1313
import javascript
14-
private import semmle.javascript.internal.TypeResolution
1514

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

0 commit comments

Comments
 (0)