Project

General

Profile

Feature #10585 » 0002-struct.c-cache-member-definition-in-a-subclass.patch

funny_falcon (Yura Sokolov), 12/10/2014 02:31 PM

View differences:

struct.c
static inline VALUE
struct_ivar_get(VALUE c, ID id)
{
for (;;) {
if (rb_ivar_defined(c, id))
return rb_ivar_get(c, id);
c = RCLASS_SUPER(c);
if (c == 0 || c == rb_cStruct)
return Qnil;
VALUE orig = c;
VALUE ivar = rb_attr_get(c, id);
if (ivar != Qnil)
return ivar;
for(;;) {
c = RCLASS_SUPER(c);
if (c == 0 || c == rb_cStruct)
return Qnil;
ivar = rb_attr_get(c, id);
if (ivar != Qnil) {
rb_ivar_set(orig, id, ivar);
return ivar;
}
}
}
(2-2/5)