1
0
forked from VimPlug/jedi

introduce an is_scope function to make it easier to work with scopes

This commit is contained in:
Dave Halter
2014-06-20 17:47:42 +02:00
parent 3ee3a04bcb
commit ddca14980e
4 changed files with 12 additions and 4 deletions

View File

@@ -169,6 +169,9 @@ class CompiledObject(Base):
faked_subscopes.append(f)
return faked_subscopes
def is_scope(self):
return True
def get_self_attributes(self):
return [] # Instance compatibility

View File

@@ -478,8 +478,7 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
while scope:
# We don't want submodules to report if we have modules.
# As well as some non-scopes, which are parents of list comprehensions.
if isinstance(scope, pr.SubModule) and scope.parent \
or not isinstance(scope, pr.IsScope):
if isinstance(scope, pr.SubModule) and scope.parent or not scope.is_scope():
scope = scope.parent
continue
# `pr.Class` is used, because the parent is never `Class`.