mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Revert "[DOC] Fixed the class name in FrozenError#receiver"
This reverts commit 5f56a5fc9b
.
`FrozenError.new(mesg, nil).receiver` should not raise an
ArgumentError.
This commit is contained in:
parent
52b1ba0b02
commit
38b9d213f1
1 changed files with 10 additions and 22 deletions
32
error.c
32
error.c
|
@ -1409,17 +1409,6 @@ exit_success_p(VALUE exc)
|
|||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
err_attr_receiver(VALUE self)
|
||||
{
|
||||
VALUE recv;
|
||||
|
||||
recv = rb_ivar_lookup(self, id_receiver, Qundef);
|
||||
if (recv == Qundef)
|
||||
rb_raise(rb_eArgError, "no receiver is available");
|
||||
return recv;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* FrozenError.new(msg=nil, receiver=nil) -> frozen_error
|
||||
|
@ -1446,15 +1435,6 @@ frozen_err_initialize(int argc, VALUE *argv, VALUE self)
|
|||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* frozen_error.receiver -> object
|
||||
*
|
||||
* Return the receiver associated with this FrozenError exception.
|
||||
*/
|
||||
|
||||
#define frozen_err_receiver err_attr_receiver
|
||||
|
||||
void
|
||||
rb_name_error(ID id, const char *fmt, ...)
|
||||
{
|
||||
|
@ -1822,7 +1802,15 @@ rb_invalid_str(const char *str, const char *type)
|
|||
* Return the receiver associated with this KeyError exception.
|
||||
*/
|
||||
|
||||
#define key_err_receiver err_attr_receiver
|
||||
static VALUE
|
||||
key_err_receiver(VALUE self)
|
||||
{
|
||||
VALUE recv;
|
||||
|
||||
recv = rb_ivar_lookup(self, id_receiver, Qundef);
|
||||
if (recv != Qundef) return recv;
|
||||
rb_raise(rb_eArgError, "no receiver is available");
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
|
@ -2541,7 +2529,7 @@ Init_Exception(void)
|
|||
rb_eRuntimeError = rb_define_class("RuntimeError", rb_eStandardError);
|
||||
rb_eFrozenError = rb_define_class("FrozenError", rb_eRuntimeError);
|
||||
rb_define_method(rb_eFrozenError, "initialize", frozen_err_initialize, -1);
|
||||
rb_define_method(rb_eFrozenError, "receiver", frozen_err_receiver, 0);
|
||||
rb_define_method(rb_eFrozenError, "receiver", name_err_receiver, 0);
|
||||
rb_eSecurityError = rb_define_class("SecurityError", rb_eException);
|
||||
rb_eNoMemError = rb_define_class("NoMemoryError", rb_eException);
|
||||
rb_eEncodingError = rb_define_class("EncodingError", rb_eStandardError);
|
||||
|
|
Loading…
Add table
Reference in a new issue