Skip to content

Commit

Permalink
Make use of getContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Brignull committed May 4, 2020
1 parent d90fca3 commit dcd81b5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion queries/undeclared-action-input.ql
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ class ActionDeclaration extends File {
}

Expr getAFunctionChildExpr(Function f) {
result = f.getBody().getAChildStmt*().getAChildExpr*()
result.getContainer() = f
}

/*
* Result is a function that is called from the body of the given function `f`
*/
Function calledBy(Function f) {
result = getAFunctionChildExpr(f).(InvokeExpr).getResolvedCallee()
or
result.getEnclosingContainer() = f // assume outer function causes inner function to be called
}

class GetInputMethodCallExpr extends MethodCallExpr {
Expand Down

0 comments on commit dcd81b5

Please sign in to comment.