mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 04:55:21 +02:00
* eval.c (rb_f_missing): create exception instance by ordinal
method. * error.c (rb_name_error, rb_sys_fail): ditto. * error.c (exc_to_s, exit_status, name_err_name, nometh_err_args, syserr_errno, syserr_eqq): access attributes. * error.c (name_err_initialize, nometh_err_initialize, syserr_initialize): initialize attributes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
340e5082e2
commit
7f425b216b
3 changed files with 100 additions and 36 deletions
11
eval.c
11
eval.c
|
@ -4599,13 +4599,18 @@ rb_f_missing(argc, argv, obj)
|
|||
{
|
||||
char buf[BUFSIZ];
|
||||
int noclass = (!d || desc[0]=='#');
|
||||
int n = 0;
|
||||
VALUE args[3];
|
||||
|
||||
snprintf(buf, BUFSIZ, format, rb_id2name(id),
|
||||
desc, noclass ? "" : ":",
|
||||
noclass ? "" : rb_obj_classname(obj));
|
||||
exc = rb_exc_new2(exc, buf);
|
||||
rb_iv_set(exc, "name", argv[0]);
|
||||
rb_iv_set(exc, "args", rb_ary_new4(argc-1, argv+1));
|
||||
args[n++] = rb_str_new2(buf);
|
||||
args[n++] = argv[0];
|
||||
if (exc == rb_eNoMethodError) {
|
||||
args[n++] = rb_ary_new4(argc-1, argv+1);
|
||||
}
|
||||
exc = rb_class_new_instance(n, args, exc);
|
||||
rb_exc_raise(exc);
|
||||
}
|
||||
POP_FRAME();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue