mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
error.c: remove NameError#to_s
* error.c (name_err_to_s): remove no longer needed overriding, since r30455 which made exc_to_s almost same. Fixes [GH-413]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a21c8cc27
commit
6cb24cee64
2 changed files with 6 additions and 22 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Oct 28 13:17:17 2013 Or Cohen <orc@fewbytes.com>
|
||||
|
||||
* error.c (name_err_to_s): remove no longer needed overriding, since
|
||||
r30455 which made exc_to_s almost same. Fixes [GH-413].
|
||||
|
||||
Mon Oct 28 12:42:11 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* common.mk, ext/objspace/depend, ext/coverage/depend,
|
||||
|
|
23
error.c
23
error.c
|
@ -641,11 +641,9 @@ static VALUE
|
|||
exc_to_s(VALUE exc)
|
||||
{
|
||||
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
|
||||
VALUE r = Qnil;
|
||||
|
||||
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
|
||||
r = rb_String(mesg);
|
||||
return r;
|
||||
return rb_String(mesg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -991,24 +989,6 @@ name_err_name(VALUE self)
|
|||
return rb_attr_get(self, rb_intern("name"));
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* name_error.to_s -> string
|
||||
*
|
||||
* Produce a nicely-formatted string representing the +NameError+.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
name_err_to_s(VALUE exc)
|
||||
{
|
||||
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
|
||||
VALUE str = mesg;
|
||||
|
||||
if (NIL_P(mesg)) return rb_class_name(CLASS_OF(exc));
|
||||
StringValue(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* NoMethodError.new(msg, name [, args]) -> no_method_error
|
||||
|
@ -1790,7 +1770,6 @@ Init_Exception(void)
|
|||
rb_eNameError = rb_define_class("NameError", rb_eStandardError);
|
||||
rb_define_method(rb_eNameError, "initialize", name_err_initialize, -1);
|
||||
rb_define_method(rb_eNameError, "name", name_err_name, 0);
|
||||
rb_define_method(rb_eNameError, "to_s", name_err_to_s, 0);
|
||||
rb_cNameErrorMesg = rb_define_class_under(rb_eNameError, "message", rb_cData);
|
||||
rb_define_singleton_method(rb_cNameErrorMesg, "!", rb_name_err_mesg_new, NAME_ERR_MESG_COUNT);
|
||||
rb_define_method(rb_cNameErrorMesg, "==", name_err_mesg_equal, 1);
|
||||
|
|
Loading…
Reference in a new issue