mirror of
https://github.com/github/codeql.git
synced 2026-05-03 12:45:27 +02:00
add code example to isDecoratedCall
This commit is contained in:
@@ -237,6 +237,18 @@ module HTTP {
|
||||
* Holds if `call` decorates the function `pred`.
|
||||
* This means that `call` returns a function that forwards its arguments to `pred`.
|
||||
* Only holds when the decorator looks like it is decorating a route-handler.
|
||||
*
|
||||
* Below is a code example relating `call`, `decoratee`, `outer`, `inner`.
|
||||
* ```
|
||||
* function outer(method) {
|
||||
* return function inner(req, res) {
|
||||
* return method.call(this, req, res);
|
||||
* };
|
||||
* }
|
||||
* var route = outer(function decoratee(req, res) { // <- call
|
||||
* res.end("foo");
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
private predicate isDecoratedCall(DataFlow::CallNode call, DataFlow::FunctionNode decoratee) {
|
||||
// indirect route-handler `result` is given to function `outer`, which returns function `inner` which calls the function `pred`.
|
||||
|
||||
Reference in New Issue
Block a user