}
// Check for methods that are explicitly undefined
if (method.isUndefined()) {
throw new RaiseException(getContext().getCoreLibrary().noMethodError(name, receiver.toString(), this));
}
// Check visibility
if (!ignoreVisibility && !method.isVisibleTo(this, callerClass)) {
if (dispatchAction == Dispatch.DispatchAction.CALL_METHOD) {
throw new RaiseException(getContext().getCoreLibrary().privateMethodError(name, receiver.toString(), this));
} else if (dispatchAction == Dispatch.DispatchAction.RESPOND_TO_METHOD) {
return null;
} else {
throw new UnsupportedOperationException();
}