Add __getattr__ checks with proper inheritance.

This commit is contained in:
Dave Halter
2014-06-26 12:56:01 +02:00
parent a936cea987
commit 4238538df4
2 changed files with 28 additions and 3 deletions

View File

@@ -318,9 +318,10 @@ class Class(use_metaclass(CachedMetaClass, pr.IsScope)):
return result + list(type_cls.get_defined_names())
def get_subscope_by_name(self, name):
for sub in reversed(self.subscopes):
if sub.name.get_code() == name:
return sub
for s in [self] + self.get_super_classes():
for sub in reversed(s.subscopes):
if sub.name.get_code() == name:
return sub
raise KeyError("Couldn't find subscope.")
def is_callable(self):