Skip to content

Commit c694732

Browse files
committed
use isAsyncOrGenerator instead of isOrdinary
1 parent 6142739 commit c694732

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

javascript/ql/src/semmle/javascript/Functions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
204204
/** Holds if this function is an asynchronous function. */
205205
predicate isAsync() { isAsync(this) }
206206

207-
/** Holds if this function is not asynchronous and also not a generator. */
208-
predicate isOrdinary() { not isAsync() and not isGenerator() }
207+
/** Holds if this function is asynchronous or a generator. */
208+
predicate isAsyncOrGenerator() { isAsync() or isGenerator() }
209209

210210
/** Gets the enclosing function or toplevel of this function. */
211211
override StmtContainer getEnclosingContainer() { result = getEnclosingStmt().getContainer() }

javascript/ql/src/semmle/javascript/dataflow/Configuration.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ private predicate storeStep(
10311031
summary = PathSummary::level()
10321032
or
10331033
exists(Function f, DataFlow::Node mid, DataFlow::Node invk |
1034-
f.isOrdinary() and invk = succ
1034+
not f.isAsyncOrGenerator() and invk = succ
10351035
or
10361036
// store in an immediately awaited function call
10371037
f.isAsync() and
@@ -1156,7 +1156,7 @@ private predicate loadStep(
11561156
summary = PathSummary::level()
11571157
or
11581158
exists(Function f, DataFlow::Node read, DataFlow::Node invk |
1159-
f.isOrdinary() and invk = succ
1159+
not f.isAsyncOrGenerator() and invk = succ
11601160
or
11611161
// load from an immediately awaited function call
11621162
f.isAsync() and

javascript/ql/src/semmle/javascript/dataflow/DataFlow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ module DataFlow {
14951495
)
14961496
or
14971497
// from returned expr to the FunctionReturnNode.
1498-
exists(Function f | f.isOrdinary() |
1498+
exists(Function f | not f.isAsyncOrGenerator() |
14991499
DataFlow::functionReturnNode(succ, f) and pred = valueNode(f.getAReturnedExpr())
15001500
)
15011501
}

javascript/ql/src/semmle/javascript/dataflow/TrackedNodes.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ private module NodeTracking {
243243
basicStoreStep(pred, succ, prop) and
244244
summary = PathSummary::level()
245245
or
246-
exists(Function f, DataFlow::Node mid | f.isOrdinary() |
246+
exists(Function f, DataFlow::Node mid | not f.isAsyncOrGenerator() |
247247
// `f` stores its parameter `pred` in property `prop` of a value that flows back to the caller,
248248
// and `succ` is an invocation of `f`
249249
reachableFromInput(f, succ, pred, mid, summary) and
@@ -266,7 +266,7 @@ private module NodeTracking {
266266
basicLoadStep(pred, succ, prop) and
267267
summary = PathSummary::level()
268268
or
269-
exists(Function f, DataFlow::SourceNode parm | f.isOrdinary() |
269+
exists(Function f, DataFlow::SourceNode parm | not f.isAsyncOrGenerator() |
270270
argumentPassing(succ, pred, f, parm) and
271271
reachesReturn(f, parm.getAPropertyRead(prop), summary)
272272
)

0 commit comments

Comments
 (0)