View definition

func EnclosingFunction

Defined in


EnclosingFunction returns the function that contains the syntax node denoted by path.

Syntax associated with package-level variable specifications is enclosed by the package's init() function.

Returns nil if not found; reasons might include:

- the node is not enclosed by any function.
- the node is within an anonymous function (FuncLit) and
  its SSA function has not been created yet
  (pkg.Build() has not yet been called).