mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Use proper target_class to define class/module; fix #3843
The outer class of the class/module definition should be taken from `MRB_TARGET_CLASS(mrb->c->ci->proc)` not `mrb->c->ci->target_class` which is the target of constant lookups.
This commit is contained in:
@@ -2731,7 +2731,7 @@ RETRY_TRY_BLOCK:
|
||||
base = regs[a];
|
||||
super = regs[a+1];
|
||||
if (mrb_nil_p(base)) {
|
||||
baseclass = mrb->c->ci->target_class;
|
||||
baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);
|
||||
base = mrb_obj_value(baseclass);
|
||||
}
|
||||
c = mrb_vm_define_class(mrb, base, super, id);
|
||||
@@ -2749,7 +2749,7 @@ RETRY_TRY_BLOCK:
|
||||
|
||||
base = regs[a];
|
||||
if (mrb_nil_p(base)) {
|
||||
baseclass = mrb->c->ci->target_class;
|
||||
baseclass = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc);
|
||||
base = mrb_obj_value(baseclass);
|
||||
}
|
||||
c = mrb_vm_define_module(mrb, base, id);
|
||||
|
||||
Reference in New Issue
Block a user