Skip to content
Permalink
Browse files
Find Class/Module in nested singleton class; fix #3598
  • Loading branch information
keizo042 committed Apr 12, 2017
1 parent 0fb05eb commit 4fca570a742f7f1dae7830410a16998f34342c4c
Showing 1 changed file with 3 additions and 4 deletions.
@@ -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);

0 comments on commit 4fca570

Please sign in to comment.