JS: Update API usage in MissingAwait

This commit is contained in:
Asger F
2025-06-04 12:48:39 +02:00
parent e459884b69
commit fcb6882f16
2 changed files with 6 additions and 2 deletions

View File

@@ -132,6 +132,11 @@ class TypeNameBindingNode extends NameResolution::Node {
* and enums and enum members have this property.
*/
predicate isSanitizingPrimitiveType() { TypeResolution::isSanitizingPrimitiveType(this) }
/**
* Holds if the given type is a Promise object. Does not hold for unions unless all parts of the union are promises.
*/
predicate isPromiseType() { TypeResolution::isPromiseType(this) }
}
/**

View File

@@ -11,7 +11,6 @@
*/
import javascript
private import semmle.javascript.internal.TypeResolution
/**
* Holds if `call` is a call to an `async` function.
@@ -30,7 +29,7 @@ predicate isPromise(DataFlow::SourceNode node, boolean nullable) {
isAsyncCall(node, nullable)
or
not isAsyncCall(node, _) and
TypeResolution::valueHasPromiseType(node.asExpr()) and
node.asExpr().getTypeBinding().isPromiseType() and
nullable = true
}