Skip to content

Commit 688e7a9

Browse files
committed
improves docs
1 parent 7ef33de commit 688e7a9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,11 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
159159
}
160160

161161
/**
162-
* Gets a `ConcreteControlFlowNode` which corresponds to an executable portion of
163-
* the body which can be executed last during a function call, and which does not
164-
* result in the return of a value.
162+
* Gets a return from a function which has undefined value (i.e. implicit returns
163+
* and returns w/o expressions).
165164
*/
166165

167-
/*
168-
* Functions can sometimes return without returning a value, in which case they
169-
* "return" `undefined`. They can do this in two ways:
166+
/* Functions can have undefined returns in a few different ways:
170167
*
171168
* 1. An explicit return statement with no expression, i.e. the statement `return;`
172169
*
@@ -185,7 +182,9 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
185182
* statements prevent the containing function from returning, so they don't count
186183
* as undefined returns. Similarly, `yield` doesn't actually cause a return,
187184
* since the containing function is a generator and can be re-entered, so we also
188-
* exclude yields entirely.
185+
* exclude yields entirely. Likewise, we exclude generator functions from
186+
* consideration, as well as asynchronous functions, since calls to both produce
187+
* something distinct from what's explicitly returned by the function.
189188
*/
190189

191190
ConcreteControlFlowNode getAnUndefinedReturn() {

0 commit comments

Comments
 (0)