code: public SymbolScope getEnclosingFunctionScope(Node n) {
      Node current = n.getParent();
      if (n.isName() && current != null && current.isFunction()) {
        current = current.getParent();
      }
  
      for (; current != null; current = current.getParent()) {
        SymbolScope scope = scopes.get(current);
        if (scope != null && !scope.isBlockScope()) {
          return scope;
        }
      }
      return globalScope;
    }
docs: Gets the scope that contains the given node. If {@code n} is a function name, we return the
  scope that contains the function, not the function itself. The returned scope is either
  function or global scope.