1
0
forked from VimPlug/jedi

fix list comprehension issues in nested parentheses.

This commit is contained in:
Dave Halter
2014-06-20 17:29:30 +02:00
parent 2fc404f99d
commit 3ee3a04bcb
2 changed files with 8 additions and 2 deletions

View File

@@ -476,8 +476,10 @@ def get_names_of_scope(evaluator, scope, position=None, star_search=True, includ
in_func_scope = scope
non_flow = scope.get_parent_until(pr.Flow, reverse=True)
while scope:
if isinstance(scope, pr.SubModule) and scope.parent:
# we don't want submodules to report if we have modules.
# 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):
scope = scope.parent
continue
# `pr.Class` is used, because the parent is never `Class`.

View File

@@ -151,6 +151,10 @@ def listen(arg):
x
listen(['' for x in [1]])
#? str()
([str for x in []])[0]
# -----------------
# nested list comprehensions
# -----------------