mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
super look-up scheme fixed; close #415
This commit is contained in:
@@ -333,7 +333,6 @@ mrb_define_method_vm(mrb_state *mrb, struct RClass *c, mrb_sym name, mrb_value b
|
||||
if (!h) h = c->mt = kh_init(mt, mrb);
|
||||
k = kh_put(mt, h, name);
|
||||
p = mrb_proc_ptr(body);
|
||||
if (p) p->target_class = c;
|
||||
kh_value(h, k) = p;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,8 +15,8 @@ mrb_proc_new(mrb_state *mrb, mrb_irep *irep)
|
||||
struct RProc *p;
|
||||
|
||||
p = (struct RProc*)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb->proc_class);
|
||||
p->body.irep = irep;
|
||||
p->target_class = (mrb->ci) ? mrb->ci->target_class : 0;
|
||||
p->body.irep = irep;
|
||||
p->env = 0;
|
||||
|
||||
return p;
|
||||
|
||||
@@ -717,7 +717,7 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
|
||||
ci->stackidx = mrb->stack - mrb->stbase;
|
||||
ci->argc = n;
|
||||
if (ci->argc == CALL_MAXARGS) ci->argc = -1;
|
||||
ci->target_class = m->target_class;
|
||||
ci->target_class = c;
|
||||
ci->pc = pc + 1;
|
||||
ci->acc = a;
|
||||
|
||||
@@ -832,10 +832,9 @@ mrb_run(mrb_state *mrb, struct RProc *proc, mrb_value self)
|
||||
int n = GETARG_C(i);
|
||||
|
||||
recv = regs[0];
|
||||
c = mrb->ci->proc->target_class->super;
|
||||
c = mrb->ci->target_class->super;
|
||||
m = mrb_method_search_vm(mrb, &c, mid);
|
||||
if (!m) {
|
||||
c = mrb->ci->proc->target_class;
|
||||
mid = mrb_intern(mrb, "method_missing");
|
||||
m = mrb_method_search_vm(mrb, &c, mid);
|
||||
if (n == CALL_MAXARGS) {
|
||||
|
||||
Reference in New Issue
Block a user