bug-7499.patch

Charlie Somerville, 12/03/2012 08:10 PM

Download (2.7 KB)

View differences:

vm_eval.c
289 289
 * \param argc   the number of method arguments
290 290
 * \param argv   a pointer to an array of method arguments
291 291
 * \param scope
292
 * \param self   self in the caller. Qundef means the current control frame's self.
292
 * \param self   self in the caller. Qundef means no self is considered and
293
 *               protected methods cannot be called
293 294
 *
294 295
 * \note \a self is used in order to controlling access to protected methods.
295 296
 */
......
364 365
    }
365 366

  
366 367
    me = rb_search_method_entry(Qnil, recv, mid, &defined_class);
367
    call_status = rb_method_call_status(th, me, CALL_FCALL, Qundef);
368
    call_status = rb_method_call_status(th, me, CALL_FCALL, th->cfp->self);
368 369
    if (call_status != NOEX_OK) {
369 370
	if (rb_method_basic_definition_p(klass, idMethodMissing)) {
370 371
	    return Qundef;
......
501 502
		    defined_class = RBASIC(defined_class)->klass;
502 503
		}
503 504

  
504
		if (self == Qundef) {
505
		    self = th->cfp->self;
506
		}
507
		if (!rb_obj_is_kind_of(self, defined_class)) {
505
		if (self == Qundef || !rb_obj_is_kind_of(self, defined_class)) {
508 506
		    return NOEX_PROTECTED;
509 507
		}
510 508
	    }
......
533 531
static inline VALUE
534 532
rb_call(VALUE recv, ID mid, int argc, const VALUE *argv, call_type scope)
535 533
{
536
    return rb_call0(recv, mid, argc, argv, scope, Qundef, Qnil);
534
    rb_thread_t* th = GET_THREAD();
535
    return rb_call0(recv, mid, argc, argv, scope, th->cfp->self, Qnil);
537 536
}
538 537

  
539 538
NORETURN(static void raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv,
......
786 785
					  const VALUE *argv,
787 786
					  VALUE refinements)
788 787
{
789
    PASS_PASSED_BLOCK_TH(GET_THREAD());
788
    rb_thread_t* th = GET_THREAD();
789
    PASS_PASSED_BLOCK_TH(th);
790 790

  
791
    return rb_call0(recv, mid, argc, argv, CALL_PUBLIC, Qundef,
791
    return rb_call0(recv, mid, argc, argv, CALL_PUBLIC, th->cfp->self,
792 792
		    refinements);
793 793
}
794 794

  
......
797 797
{
798 798
    ID id;
799 799
    VALUE vid;
800
    VALUE self = RUBY_VM_PREVIOUS_CONTROL_FRAME(GET_THREAD()->cfp)->self;
800
    VALUE self;
801 801
    rb_thread_t *th = GET_THREAD();
802
    if(scope == CALL_PUBLIC) {
803
	self = Qundef;
804
    } else {
805
	self = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp)->self;
806
    }
802 807

  
803 808
    if (argc == 0) {
804 809
	rb_raise(rb_eArgError, "no method name given");