Skip to content

Commit b2c3170

Browse files
committed
add documentation to two predicates
1 parent 841dac1 commit b2c3170

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

javascript/ql/src/Statements/UseOfReturnlessFunction.ql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ predicate lastStatementHasNoEffect(Function f) {
8989
hasNoEffect(f.getExit().getAPredecessor())
9090
}
9191

92+
/**
93+
* Holds if `func` is a callee of `call`, and all possible callees of `call` never return a value.
94+
*/
9295
predicate callToVoidFunction(DataFlow::CallNode call, Function func) {
9396
not call.isIncomplete() and
9497
func = call.getACallee() and
@@ -97,6 +100,11 @@ predicate callToVoidFunction(DataFlow::CallNode call, Function func) {
97100
)
98101
}
99102

103+
/**
104+
* Holds if `name` is the name of a method from `Array.prototype` or Lodash,
105+
* where that method takes a callback as parameter,
106+
* and the callback is expected to return a value.
107+
*/
100108
predicate hasNonVoidCallbackMethod(string name) {
101109
name = "every" or
102110
name = "filter" or

0 commit comments

Comments
 (0)