mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 14:54:47 +08:00
A first very incomplete implementation of named expression support
This commit is contained in:
@@ -142,6 +142,8 @@ def eval_node(context, element):
|
|||||||
|
|
||||||
# Generator.send() is not implemented.
|
# Generator.send() is not implemented.
|
||||||
return NO_CONTEXTS
|
return NO_CONTEXTS
|
||||||
|
elif typ == 'namedexpr_test':
|
||||||
|
return eval_node(context, element.children[2])
|
||||||
else:
|
else:
|
||||||
return eval_or_test(context, element)
|
return eval_or_test(context, element)
|
||||||
|
|
||||||
|
|||||||
13
test/completion/named_expression.py
Normal file
13
test/completion/named_expression.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# python >= 3.8
|
||||||
|
b = (a:=1, a)
|
||||||
|
|
||||||
|
#? int()
|
||||||
|
b[0]
|
||||||
|
#?
|
||||||
|
b[1]
|
||||||
|
|
||||||
|
# Should not fail
|
||||||
|
b = ('':=1,)
|
||||||
|
|
||||||
|
#? int()
|
||||||
|
b[0]
|
||||||
Reference in New Issue
Block a user