Module#class_variables should check superclasses

parent a70419bc
...@@ -668,10 +668,15 @@ mrb_value ...@@ -668,10 +668,15 @@ mrb_value
mrb_mod_class_variables(mrb_state *mrb, mrb_value mod) mrb_mod_class_variables(mrb_state *mrb, mrb_value mod)
{ {
mrb_value ary; mrb_value ary;
struct RClass *c;
ary = mrb_ary_new(mrb); ary = mrb_ary_new(mrb);
if (obj_iv_p(mod) && mrb_obj_ptr(mod)->iv) { c = mrb_obj_ptr(mod);
iv_foreach(mrb, mrb_obj_ptr(mod)->iv, cv_i, &ary); while (c) {
if (c->iv) {
iv_foreach(mrb, c->iv, cv_i, &ary);
}
c = c->super;
} }
return ary; return ary;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment