mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-18 03:25:55 +08:00
fix issue with list comprehensions in function calls
This commit is contained in:
@@ -1008,6 +1008,7 @@ isinstance(c, (tokenize.Token, Operator)) else unicode(c)
|
|||||||
|
|
||||||
if isinstance(tok, Base):
|
if isinstance(tok, Base):
|
||||||
# the token is a Name, which has already been parsed
|
# the token is a Name, which has already been parsed
|
||||||
|
if not level:
|
||||||
if isinstance(tok, ListComprehension):
|
if isinstance(tok, ListComprehension):
|
||||||
# it's not possible to set it earlier
|
# it's not possible to set it earlier
|
||||||
tok.parent = self
|
tok.parent = self
|
||||||
|
|||||||
@@ -144,6 +144,13 @@ left
|
|||||||
##? str()
|
##? str()
|
||||||
{a-1:b for a,b in {1:'a', 3:1.0}.items()}[0]
|
{a-1:b for a,b in {1:'a', 3:1.0}.items()}[0]
|
||||||
|
|
||||||
|
# list comprehensions should also work in combination with functions
|
||||||
|
def listen(arg):
|
||||||
|
for x in arg:
|
||||||
|
#? str()
|
||||||
|
x
|
||||||
|
|
||||||
|
listen(['' for x in [1]])
|
||||||
# -----------------
|
# -----------------
|
||||||
# nested list comprehensions
|
# nested list comprehensions
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user