diff options
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/variable.c b/src/variable.c index c3b77d75c..a9570db02 100644 --- a/src/variable.c +++ b/src/variable.c @@ -946,10 +946,15 @@ mrb_value mrb_mod_constants(mrb_state *mrb, mrb_value mod) { mrb_value ary; + struct RClass *c = mrb_class_ptr(mod); ary = mrb_ary_new(mrb); - if (obj_iv_p(mod) && mrb_obj_ptr(mod)->iv) { - iv_foreach(mrb, mrb_obj_ptr(mod)->iv, const_i, &ary); + while (c) { + if (c->iv) { + iv_foreach(mrb, c->iv, const_i, &ary); + } + c = c->super; + if (c == mrb->object_class) break; } return ary; } |
