Project

General

Profile

Bug #7499 ยป bug-7499.patch

Anonymous, 12/03/2012 08:10 PM

View differences:

vm_eval.c
* \param argc the number of method arguments
* \param argv a pointer to an array of method arguments
* \param scope
* \param self self in the caller. Qundef means the current control frame's self.
* \param self self in the caller. Qundef means no self is considered and
* protected methods cannot be called
*
* \note \a self is used in order to controlling access to protected methods.
*/
......
}
me = rb_search_method_entry(Qnil, recv, mid, &defined_class);
call_status = rb_method_call_status(th, me, CALL_FCALL, Qundef);
call_status = rb_method_call_status(th, me, CALL_FCALL, th->cfp->self);
if (call_status != NOEX_OK) {
if (rb_method_basic_definition_p(klass, idMethodMissing)) {
return Qundef;
......
defined_class = RBASIC(defined_class)->klass;
}
if (self == Qundef) {
self = th->cfp->self;
}
if (!rb_obj_is_kind_of(self, defined_class)) {
if (self == Qundef || !rb_obj_is_kind_of(self, defined_class)) {
return NOEX_PROTECTED;
}
}
......
static inline VALUE
rb_call(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope)
{
return rb_call0(recv, mid, argc, argv, scope, Qundef, Qnil);
rb_thread_t* th = GET_THREAD();
return rb_call0(recv, mid, argc, argv, scope, th->cfp->self, Qnil);
}
NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
......
const VALUE *argv,
VALUE refinements)
{
PASS_PASSED_BLOCK_TH(GET_THREAD());
rb_thread_t* th = GET_THREAD();
PASS_PASSED_BLOCK_TH(th);
return rb_call0(recv, mid, argc, argv, CALL_PUBLIC, Qundef,
return rb_call0(recv, mid, argc, argv, CALL_PUBLIC, th->cfp->self,
refinements);
}
......
{
ID id;
VALUE vid;
VALUE self = RUBY_VM_PREVIOUS_CONTROL_FRAME(GET_THREAD()->cfp)->self;
VALUE self;
rb_thread_t *th = GET_THREAD();
if(scope == CALL_PUBLIC) {
self = Qundef;
} else {
self = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp)->self;
}
if (argc == 0) {
rb_raise(rb_eArgError, "no method name given");
    (1-1/1)