code: public static Scope getEnclosingScope(Expression2 expression, int index) {
      Preconditions.checkArgument(index < expression.size());
      ScopeSet scopes = getScopes(expression);
      return scopes.getScope(index);
    }
docs: Gets the scope of {@code expression} in which the
  subexpression at {@code index} is evaluated. This scope
  includes the bound variables, etc.
  
  @param expression
  @param index
  @return