code: public SymbolScope getEnclosingScope(Node n) {
      Node current = n.getParent();
      if (n.isName() && n.getParent().isFunction()) {
        current = current.getParent();
      }
  
      for (; current != null; current = current.getParent()) {
        if (scopes.containsKey(current)) {
          return scopes.get(current);
        }
      }
      return null;
    }
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.