diff --git a/evaluate.py b/evaluate.py index 0f73dfac..70afc225 100644 --- a/evaluate.py +++ b/evaluate.py @@ -200,6 +200,14 @@ class Class(object): self.base = base def get_defined_names(self, as_instance=False): + def in_iterable(name, iterable): + for i in iterable: + # only the last name is important, because these names have a + # maximal length of 2, with the first one being `self`. + if i.names[-1] == name.names[-1]: + return True + return False + names = self.base.get_defined_names() # check super classes: @@ -209,7 +217,7 @@ class Class(object): if as_instance: cls = Instance(cls) for i in cls.get_defined_names(): - if not i.in_iterable(names): + if not in_iterable(i, names): names.append(i) return names diff --git a/parsing.py b/parsing.py index 26b0aad4..0dfb761e 100644 --- a/parsing.py +++ b/parsing.py @@ -884,13 +884,6 @@ class Name(Simple): """ Returns the names in a full string format """ return ".".join(self.names) - def in_iterable(self, iterable): - for i in iterable: - if i.names == self.names: - return True - return False - - def __str__(self): return self.get_code() diff --git a/test/completion/ordering.py b/test/completion/ordering.py index 29c0db25..c4934e37 100644 --- a/test/completion/ordering.py +++ b/test/completion/ordering.py @@ -32,6 +32,15 @@ a.real #? ['upper'] a.upper +a = tuple +if 1: + a = list + +#? ['append'] +a.append +#? ['index'] +a.index + # ----------------- # tuples exchanges # -----------------