Skip to content

Commit 32b0f1b

Browse files
committed
add code example to isDecoratedCall
1 parent ec49c44 commit 32b0f1b

File tree

1 file changed

+12
-0
lines changed
  • javascript/ql/src/semmle/javascript/frameworks

1 file changed

+12
-0
lines changed

javascript/ql/src/semmle/javascript/frameworks/HTTP.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,18 @@ module HTTP {
237237
* Holds if `call` decorates the function `pred`.
238238
* This means that `call` returns a function that forwards its arguments to `pred`.
239239
* Only holds when the decorator looks like it is decorating a route-handler.
240+
*
241+
* Below is a code example relating `call`, `decoratee`, `outer`, `inner`.
242+
* ```
243+
* function outer(method) {
244+
* return function inner(req, res) {
245+
* return method.call(this, req, res);
246+
* };
247+
* }
248+
* var route = outer(function decoratee(req, res) { // <- call
249+
* res.end("foo");
250+
* });
251+
* ```
240252
*/
241253
private predicate isDecoratedCall(DataFlow::CallNode call, DataFlow::FunctionNode decoratee) {
242254
// indirect route-handler `result` is given to function `outer`, which returns function `inner` which calls the function `pred`.

0 commit comments

Comments
 (0)