mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
use isAsyncOrGenerator instead of isOrdinary
This commit is contained in:
@@ -204,8 +204,8 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
|
||||
/** Holds if this function is an asynchronous function. */
|
||||
predicate isAsync() { isAsync(this) }
|
||||
|
||||
/** Holds if this function is not asynchronous and also not a generator. */
|
||||
predicate isOrdinary() { not isAsync() and not isGenerator() }
|
||||
/** Holds if this function is asynchronous or a generator. */
|
||||
predicate isAsyncOrGenerator() { isAsync() or isGenerator() }
|
||||
|
||||
/** Gets the enclosing function or toplevel of this function. */
|
||||
override StmtContainer getEnclosingContainer() { result = getEnclosingStmt().getContainer() }
|
||||
|
||||
@@ -1031,7 +1031,7 @@ private predicate storeStep(
|
||||
summary = PathSummary::level()
|
||||
or
|
||||
exists(Function f, DataFlow::Node mid, DataFlow::Node invk |
|
||||
f.isOrdinary() and invk = succ
|
||||
not f.isAsyncOrGenerator() and invk = succ
|
||||
or
|
||||
// store in an immediately awaited function call
|
||||
f.isAsync() and
|
||||
@@ -1156,7 +1156,7 @@ private predicate loadStep(
|
||||
summary = PathSummary::level()
|
||||
or
|
||||
exists(Function f, DataFlow::Node read, DataFlow::Node invk |
|
||||
f.isOrdinary() and invk = succ
|
||||
not f.isAsyncOrGenerator() and invk = succ
|
||||
or
|
||||
// load from an immediately awaited function call
|
||||
f.isAsync() and
|
||||
|
||||
@@ -1495,7 +1495,7 @@ module DataFlow {
|
||||
)
|
||||
or
|
||||
// from returned expr to the FunctionReturnNode.
|
||||
exists(Function f | f.isOrdinary() |
|
||||
exists(Function f | not f.isAsyncOrGenerator() |
|
||||
DataFlow::functionReturnNode(succ, f) and pred = valueNode(f.getAReturnedExpr())
|
||||
)
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ private module NodeTracking {
|
||||
basicStoreStep(pred, succ, prop) and
|
||||
summary = PathSummary::level()
|
||||
or
|
||||
exists(Function f, DataFlow::Node mid | f.isOrdinary() |
|
||||
exists(Function f, DataFlow::Node mid | not f.isAsyncOrGenerator() |
|
||||
// `f` stores its parameter `pred` in property `prop` of a value that flows back to the caller,
|
||||
// and `succ` is an invocation of `f`
|
||||
reachableFromInput(f, succ, pred, mid, summary) and
|
||||
@@ -266,7 +266,7 @@ private module NodeTracking {
|
||||
basicLoadStep(pred, succ, prop) and
|
||||
summary = PathSummary::level()
|
||||
or
|
||||
exists(Function f, DataFlow::SourceNode parm | f.isOrdinary() |
|
||||
exists(Function f, DataFlow::SourceNode parm | not f.isAsyncOrGenerator() |
|
||||
argumentPassing(succ, pred, f, parm) and
|
||||
reachesReturn(f, parm.getAPropertyRead(prop), summary)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user