docs: public static Callable getElemFunctionAndThis(Object obj, Object elem,
                                                    Context cx, Scriptable scope)
      {
          Scriptable thisObj;
          Object value;
  
          if (isSymbol(elem)) {
              thisObj = toObjectOrNull(cx, obj, scope);
              if (thisObj == null) {
                  throw undefCallError(obj, String.valueOf(elem));
              }
              value = ScriptableObject.getProperty(thisObj, (Symbol)elem);
  
          } else {
              String str = toStringIdOrIndex(cx, elem);
              if (str != null) {
                  return getPropFunctionAndThis(obj, str, cx, scope);
              }
              int index = lastIndexResult(cx);
  
              thisObj = toObjectOrNull(cx, obj, scope);
              if (thisObj == null) {
                  throw undefCallError(obj, String.valueOf(elem));
              }
  
              value = ScriptableObject.getProperty(thisObj, index);
          }
  
          if (!(value instanceof Callable)) {
              throw notFunctionError(value, elem);
          }
  
          storeScriptable(cx, thisObj);
          return (Callable)value;
      }