code: public FunctionNode getEnclosingFunction() {
          AstNode parent = this.getParent();
          while (parent != null && !(parent instanceof FunctionNode)) {
              parent = parent.getParent();
          }
          return (FunctionNode)parent;
      }
docs: Returns the innermost enclosing function, or {@code null} if not in a
  function.  Begins the search with this node's parent.
  @return the {@link FunctionNode} enclosing this node, else {@code null}