summaryrefslogtreecommitdiffhomepage
path: root/src/vm.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-11-09 00:14:21 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-11-09 00:14:21 +0900
commit41c8c419cf7d9cc220a39696e2e498881394352b (patch)
tree3dbbc4add642f98f31ab998d1cfaed7d7bffb639 /src/vm.c
parentf723832ebc6b3fef41ca4e81a172cb2d8f27b7de (diff)
downloadmruby-41c8c419cf7d9cc220a39696e2e498881394352b.tar.gz
mruby-41c8c419cf7d9cc220a39696e2e498881394352b.zip
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.
Diffstat (limited to 'src/vm.c')
-rw-r--r--src/vm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/vm.c b/src/vm.c
index 8d5bbc6d8..52eca83aa 100644
--- a/src/vm.c
+++ b/src/vm.c
@@ -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);