mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Find Class/Module in nested singleton class; fix #3598
This commit is contained in:
+3
-4
@@ -953,14 +953,13 @@ mrb_vm_const_get(mrb_state *mrb, mrb_sym sym)
|
||||
if (c->iv && iv_get(mrb, c->iv, sym, &v)) {
|
||||
return v;
|
||||
}
|
||||
if (c->tt == MRB_TT_SCLASS) {
|
||||
for (c2 = c; c2 && c2->tt == MRB_TT_SCLASS;) {
|
||||
mrb_value klass;
|
||||
klass = mrb_obj_iv_get(mrb, (struct RObject *)c,
|
||||
klass = mrb_obj_iv_get(mrb, (struct RObject *)c2,
|
||||
mrb_intern_lit(mrb, "__attached__"));
|
||||
c2 = mrb_class_ptr(klass);
|
||||
if (c2->tt == MRB_TT_CLASS || c2->tt == MRB_TT_MODULE)
|
||||
c = c2;
|
||||
}
|
||||
if (c2->tt == MRB_TT_CLASS || c2->tt == MRB_TT_MODULE) c = c2;
|
||||
c2 = c;
|
||||
for (;;) {
|
||||
c2 = mrb_class_outer_module(mrb, c2);
|
||||
|
||||
Reference in New Issue
Block a user