forked from VimPlug/jedi
add an empty IsScope class to match all scopes
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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 "<e%s of %s>" % (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.
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user