summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--error.c3
-rw-r--r--vm_core.h2
-rw-r--r--vm_eval.c9
3 files changed, 3 insertions, 11 deletions
diff --git a/error.c b/error.c
index 70ebe6b..e41908c 100644
--- a/error.c
+++ b/error.c
@@ -1158,7 +1158,7 @@ static const rb_data_type_t name_err_mesg_data_type = {
/* :nodoc: */
VALUE
-rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method)
+rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method)
{
VALUE result = TypedData_Wrap_Struct(rb_cNameErrorMesg, &name_err_mesg_data_type, 0);
VALUE *ptr = ALLOC_N(VALUE, NAME_ERR_MESG_COUNT);
@@ -1904,7 +1904,6 @@ Init_Exception(void)
rb_define_method(rb_eNameError, "name", name_err_name, 0);
rb_define_method(rb_eNameError, "receiver", name_err_receiver, 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);
rb_define_method(rb_cNameErrorMesg, "to_str", name_err_mesg_to_str, 0);
rb_define_method(rb_cNameErrorMesg, "_dump", name_err_mesg_dump, 1);
diff --git a/vm_core.h b/vm_core.h
index c0e63cd..72a1b2d 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1010,7 +1010,7 @@ typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
rb_control_frame_t *rb_vm_get_binding_creatable_next_cfp(const rb_thread_t *th, const rb_control_frame_t *cfp);
int rb_vm_get_sourceline(const rb_control_frame_t *);
-VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method);
+VALUE rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method);
void rb_vm_stack_to_heap(rb_thread_t *th);
void ruby_thread_init_stack(rb_thread_t *th);
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, VALUE *klassp);
diff --git a/vm_eval.c b/vm_eval.c
index fd2277f..bbc7666 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -668,19 +668,12 @@ static VALUE
make_no_method_exception(VALUE exc, const char *format, VALUE obj, int argc, const VALUE *argv)
{
int n = 0;
- VALUE mesg;
VALUE args[3];
if (!format) {
format = "undefined method `%s' for %s";
}
- mesg = rb_const_get(exc, rb_intern("message"));
- if (rb_method_basic_definition_p(CLASS_OF(mesg), '!')) {
- args[n++] = rb_name_err_mesg_new(mesg, rb_str_new2(format), obj, argv[0]);
- }
- else {
- args[n++] = rb_funcall(mesg, '!', 3, rb_str_new2(format), obj, argv[0]);
- }
+ args[n++] = rb_name_err_mesg_new(rb_str_new_cstr(format), obj, argv[0]);
args[n++] = argv[0];
if (exc == rb_eNoMethodError) {
args[n++] = rb_ary_new4(argc - 1, argv + 1);