CodeQL library for JavaScript

Member predicate LocalVariable::getDeclaringContainer

Gets the function or toplevel in which this variable is declared; arguments variables are taken to be implicitly declared in the function to which they belong.

Note that for a function expression function f() { ... } the variable f is declared in the function itself, while for a function statement it is declared in the enclosing container.

StmtContainer getDeclaringContainer()