Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
CodeQL library for Swift
codeql/swift-all 4.3.0 (changelog, source)

Member predicate Impl::AstNode::getEnclosingFunction

Gets the nearest function definition that contains this AST node, if any. This includes functions, methods, (de)initializers, and accessors, but not closures.

For example, in the following code, the AST node for n + 1 has foo as its enclosing function (via getEnclosingFunction), whereas its enclosing callable is the closure {(n : Int) in n + 1 } (via getEnclosingCallable):

func foo() {
  var f = { (n : Int) in n + 1 }
}
Function getEnclosingFunction()