1.1 --- a/templates/native/introspection.c Fri Jan 20 23:59:15 2017 +0100
1.2 +++ b/templates/native/introspection.c Sat Jan 21 00:01:25 2017 +0100
1.3 @@ -33,11 +33,28 @@
1.4 __attr * const _default = &__args[3];
1.5 /* name.__data__ interpreted as string */
1.6 __attr key = __load_via_object(name->value, __pos___key__);
1.7 + __attr out;
1.8
1.9 if ((key.code == 0) && (key.pos == 0))
1.10 return *_default;
1.11 - else
1.12 - return __check_and_load_via_any(obj->value, key.pos, key.code);
1.13 +
1.14 + /* Attempt to get the attribute from the object. */
1.15 +
1.16 + out = __check_and_load_via_object_null(obj->value, key.pos, key.code);
1.17 + if (out.value == 0)
1.18 + {
1.19 + /* Inspect the object's class if this failed. */
1.20 +
1.21 + out = __check_and_load_via_class(obj->value, key.pos, key.code);
1.22 + if (out.value == 0)
1.23 + return *_default;
1.24 +
1.25 + /* Update the context to the object if it is a method. */
1.26 +
1.27 + return __replace_context(obj->value, out);
1.28 + }
1.29 +
1.30 + return out;
1.31 }
1.32
1.33 static int __issubclass(__ref obj, __attr cls)