From 72ff61f4a8ae7a8bf05b0bd6f91b3b290645627c Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 28 Oct 2015 06:24:12 +0000 Subject: NameError#receiver of uninitialized constant * error.c (name_err_mesg_to_str): quote the name if unprintable. * object.c (check_setter_id): use rb_check_id to convert names. * variable.c (uninitialized_constant): use NameError::message to keep the receiver of uninitialized constant. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_method.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index f61c1b7d96..4059312953 100644 --- a/vm_method.c +++ b/vm_method.c @@ -918,8 +918,8 @@ remove_method(VALUE klass, ID mid) !(me = (rb_method_entry_t *)data) || (!me->def || me->def->type == VM_METHOD_TYPE_UNDEF) || UNDEFINED_REFINED_METHOD_P(me->def)) { - rb_name_error(mid, "method `%"PRIsVALUE"' not defined in %"PRIsVALUE, - rb_id2str(mid), rb_class_path(klass)); + rb_name_err_raise("method `%1$s' not defined in %2$s", + klass, ID2SYM(mid)); } rb_id_table_delete(RCLASS_M_TBL(klass), mid); @@ -965,8 +965,8 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod) VALUE v = argv[i]; ID id = rb_check_id(&v); if (!id) { - rb_name_error_str(v, "method `%"PRIsVALUE"' not defined in %"PRIsVALUE, - v, rb_obj_class(mod)); + rb_name_err_raise("method `%1$s' not defined in %2$s", + mod, v); } remove_method(mod, id); } -- cgit v1.2.3