From 89800697e5d28d123be00de047c85b4c44ce4c61 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 10 Feb 2003 09:40:13 +0000 Subject: * array.c (rb_ary_to_a): return value should be an Array if the receiver is an instance of subclass of Array. * string.c (rb_str_to_s): return value should be a String if the receiver is an instance of subclass of String. * eval.c (rb_call): calls method_missing when superclass method does not exist. * eval.c (rb_f_missing): now handles "no super" case. * object.c (rb_obj_ivar_get): Object#instance_variable_get: new method to get instance variable value without eval(). [new] * object.c (rb_obj_ivar_set): Object#instance_variable_set: new method to set instance variable value without eval(). [new] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'eval.c') diff --git a/eval.c b/eval.c index a2cc8bb64..bd86870d8 100644 --- a/eval.c +++ b/eval.c @@ -4352,6 +4352,7 @@ static int last_call_status; #define CSTAT_PRIV 1 #define CSTAT_PROT 2 #define CSTAT_VCALL 4 +#define CSTAT_SUPER 8 static VALUE rb_f_missing(argc, argv, obj) @@ -4412,6 +4413,9 @@ rb_f_missing(argc, argv, obj) exc = rb_eNameError; } } + else if (last_call_status & CSTAT_SUPER) { + format = "super: no superclass method `%s'"; + } if (!format) { format = "undefined method `%s' for %s%s%s"; } @@ -4807,8 +4811,7 @@ rb_call(klass, recv, mid, argc, argv, scope) } else if ((body = rb_get_method_body(&klass, &id, &noex)) == 0) { if (scope == 3) { - rb_name_error(mid, "super: no superclass method `%s'", - rb_id2name(mid)); + return rb_undefined(recv, mid, argc, argv, CSTAT_SUPER); } return rb_undefined(recv, mid, argc, argv, scope==2?CSTAT_VCALL:0); } -- cgit