use isAsyncOrGenerator instead of isOrdinary

This commit is contained in:
Erik Krogh Kristensen
2020-09-01 13:11:44 +02:00
parent 61427393be
commit c6947320ea
4 changed files with 7 additions and 7 deletions

View File

@@ -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() }

View File

@@ -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

View File

@@ -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())
)
}

View File

@@ -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)
)