ruby-changes:2355
From: ko1@a...
Date: 9 Nov 2007 11:04:02 +0900
Subject: [ruby-changes:2355] nobu - Ruby:r13846 (trunk): * eval.c (send_internal): use self in the previous frame to check for
nobu 2007-11-09 10:43:57 +0900 (Fri, 09 Nov 2007) New Revision: 13846 Modified files: trunk/ChangeLog trunk/eval.c trunk/insnhelper.ci Log: * eval.c (send_internal): use self in the previous frame to check for protected methods. [ruby-core:13254] * insnhelper.ci (vm_call_method): send! method has gone. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/insnhelper.ci?r1=13846&r2=13845 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=13846&r2=13845 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/eval.c?r1=13846&r2=13845 Index: ChangeLog =================================================================== --- ChangeLog (revision 13845) +++ ChangeLog (revision 13846) @@ -1,3 +1,10 @@ +Fri Nov 9 10:43:55 2007 Nobuyoshi Nakada <nobu@r...> + + * eval.c (send_internal): use self in the previous frame to check for + protected methods. [ruby-core:13254] + + * insnhelper.ci (vm_call_method): send! method has gone. + Fri Nov 9 10:38:13 2007 Koichi Sasada <ko1@a...> * marshal.c (w_object): should be SPECIAL_CONST_P() instead of Index: eval.c =================================================================== --- eval.c (revision 13845) +++ eval.c (revision 13846) @@ -1355,7 +1355,7 @@ } static VALUE -rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope) +rb_call0(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope, VALUE self) { NODE *body, *method; int noex; @@ -1409,8 +1409,7 @@ defined_class = RBASIC(defined_class)->klass; } - if (!rb_obj_is_kind_of(rb_frame_self(), - rb_class_real(defined_class))) { + if (!rb_obj_is_kind_of(self, rb_class_real(defined_class))) { return method_missing(recv, mid, argc, argv, NOEX_PROTECTED); } } @@ -1442,6 +1441,12 @@ } } +static VALUE +rb_call(VALUE klass, VALUE recv, ID mid, int argc, const VALUE *argv, int scope) +{ + return rb_call0(klass, recv, mid, argc, argv, scope, rb_frame_self()); +} + VALUE rb_apply(VALUE recv, ID mid, VALUE args) { @@ -1458,6 +1463,7 @@ send_internal(int argc, VALUE *argv, VALUE recv, int scope) { VALUE vid; + VALUE self = RUBY_VM_PREVIOUS_CONTROL_FRAME(GET_THREAD()->cfp)->self; if (argc == 0) { rb_raise(rb_eArgError, "no method name given"); @@ -1465,7 +1471,7 @@ vid = *argv++; argc--; PASS_PASSED_BLOCK(); - return rb_call(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, scope); + return rb_call0(CLASS_OF(recv), recv, rb_to_id(vid), argc, argv, scope, self); } /* Index: insnhelper.ci =================================================================== --- insnhelper.ci (revision 13845) +++ insnhelper.ci (revision 13846) @@ -547,7 +547,7 @@ val = vm_method_missing(th, id, recv, num, blockptr, stat); } else if (((mn->nd_noex & NOEX_MASK) & NOEX_PROTECTED) && - !(flag & VM_CALL_SEND_BANG_BIT)) { + !(flag & VM_CALL_SEND_BIT)) { VALUE defined_class = mn->nd_clss; if (TYPE(defined_class) == T_ICLASS) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml