1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

error.c: rb_name_err_new

* error.c (rb_name_err_new): new function to create NameError
  exception instance.  [Feature #10881]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-10-28 06:23:16 +00:00
parent 30b72f98f7
commit 7a929727f6
3 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Wed Oct 28 15:23:14 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* error.c (rb_name_err_new): new function to create NameError
exception instance. [Feature #10881]
Wed Oct 28 13:29:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Oct 28 13:29:39 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (new_attr_op_assign): fix op_assign type, which is * parse.y (new_attr_op_assign): fix op_assign type, which is

10
error.c
View file

@ -1189,6 +1189,16 @@ rb_name_err_mesg_new(VALUE mesg, VALUE recv, VALUE method)
return result; return result;
} }
VALUE
rb_name_err_new(VALUE mesg, VALUE recv, VALUE method)
{
VALUE exc = rb_obj_alloc(rb_eNameError);
rb_ivar_set(exc, id_mesg, rb_name_err_mesg_new(mesg, recv, method));
rb_ivar_set(exc, id_bt, Qnil);
rb_ivar_set(exc, id_name, method);
return exc;
}
/* :nodoc: */ /* :nodoc: */
static VALUE static VALUE
name_err_mesg_equal(VALUE obj1, VALUE obj2) name_err_mesg_equal(VALUE obj1, VALUE obj2)

View file

@ -739,6 +739,11 @@ const char *rb_builtin_class_name(VALUE x);
PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3); PRINTF_ARGS(void rb_enc_warn(rb_encoding *enc, const char *fmt, ...), 2, 3);
PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3); PRINTF_ARGS(void rb_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3); PRINTF_ARGS(void rb_sys_enc_warning(rb_encoding *enc, const char *fmt, ...), 2, 3);
VALUE rb_name_err_new(VALUE mesg, VALUE recv, VALUE method);
#define rb_name_err_raise_str(mesg, recv, name) \
rb_exc_raise(rb_name_err_new(mesg, recv, name))
#define rb_name_err_raise(mesg, recv, name) \
rb_name_err_raise_str(rb_fstring_cstr(mesg), (recv), (name))
/* eval.c */ /* eval.c */
VALUE rb_refinement_module_get_refined_class(VALUE module); VALUE rb_refinement_module_get_refined_class(VALUE module);