included_modules, origin fix

Prepended modules would include their origin ICLASS
This commit is contained in:
Corey Powell
2015-07-13 09:49:51 -05:00
parent 199a808e36
commit 81a2b3431c
+2 -1
View File
@@ -1000,10 +1000,11 @@ mrb_mod_included_modules(mrb_state *mrb, mrb_value self)
{
mrb_value result;
struct RClass *c = mrb_class_ptr(self);
struct RClass *origin = c->origin;
result = mrb_ary_new(mrb);
while (c) {
if (c->tt == MRB_TT_ICLASS) {
if (c != origin && c->tt == MRB_TT_ICLASS) {
if (c->c->tt == MRB_TT_MODULE) {
mrb_ary_push(mrb, result, mrb_obj_value(c->c));
}