From 7f425b216b18f44489c46cadcc7186ba4f04cbb7 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 20 May 2003 01:51:32 +0000 Subject: * 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 --- eval.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 0bc1fea016..d497bb4409 100644 --- a/eval.c +++ b/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(); -- cgit v1.2.3