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
24 24
static inline VALUE
25 25
struct_ivar_get(VALUE c, ID id)
26 26
{
27
    for (;;) {
28
	if (rb_ivar_defined(c, id))
29
	    return rb_ivar_get(c, id);
30
	c = RCLASS_SUPER(c);
31
	if (c == 0 || c == rb_cStruct)
32
	    return Qnil;
27
    VALUE orig = c;
28
    VALUE ivar = rb_attr_get(c, id);
29
    if (ivar != Qnil)
30
	return ivar;
31
    for(;;) {
32
        c = RCLASS_SUPER(c);
33
        if (c == 0 || c == rb_cStruct)
34
            return Qnil;
35
	ivar = rb_attr_get(c, id);
36
	if (ivar != Qnil) {
37
            rb_ivar_set(orig, id, ivar);
38
            return ivar;
39
        }
33 40
    }
34 41
}
35 42

  
36
-