diff --git a/jedi/evaluate.py b/jedi/evaluate.py index a82d26ac..3bf5f926 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -634,7 +634,7 @@ def follow_call_list(call_list, follow_array=False): def follow_call(call): """Follow a call is following a function, variable, string, etc.""" path = call.generate_call_path() - scope = call.get_parent_until((pr.Scope, er.Execution)) + scope = call.get_parent_until(pr.IsScope) return follow_call_path(path, scope, call.start_pos) diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index 7847395d..f38114c5 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -34,7 +34,7 @@ class DecoratorNotFound(LookupError): pass -class Executable(pr.Base): +class Executable(pr.IsScope): """ An instance is also an executable - because __init__ is called :param var_args: The param input array, consist of `pr.Array` or list. @@ -241,7 +241,7 @@ class InstanceElement(use_metaclass(cache.CachedMetaClass)): return "<%s of %s>" % (type(self).__name__, self.var) -class Class(use_metaclass(cache.CachedMetaClass, pr.Base)): +class Class(use_metaclass(cache.CachedMetaClass, pr.IsScope)): """ This class is not only important to extend `pr.Class`, it is also a important for descriptors (if the descriptor methods are evaluated or not). @@ -307,7 +307,7 @@ class Class(use_metaclass(cache.CachedMetaClass, pr.Base)): return "" % (type(self).__name__, self.base) -class Function(use_metaclass(cache.CachedMetaClass, pr.Base)): +class Function(use_metaclass(cache.CachedMetaClass, pr.IsScope)): """ Needed because of decorators. Decorators are evaluated here. """ diff --git a/jedi/parsing_representation.py b/jedi/parsing_representation.py index 016690cf..23396671 100644 --- a/jedi/parsing_representation.py +++ b/jedi/parsing_representation.py @@ -97,7 +97,11 @@ class Simple(Base): (type(self).__name__, code, self.start_pos[0]) -class Scope(Simple): +class IsScope(Base): + pass + + +class Scope(Simple, IsScope): """ Super class for the parser tree, which represents the state of a python text file.