mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Make goto work with await
Created together with @langsamer and @davidhalter
This commit is contained in:
@@ -44,6 +44,7 @@ Mathias Rav (@Mortal) <rav@cs.au.dk>
|
||||
Daniel Fiterman (@dfit99) <fitermandaniel2@gmail.com>
|
||||
Simon Ruggier (@sruggier)
|
||||
Élie Gouzien (@ElieGouzien)
|
||||
|
||||
Robin Roth (@robinro)
|
||||
Malte Plath (@langsamer)
|
||||
|
||||
Note: (@user) means a github user name.
|
||||
|
||||
@@ -249,6 +249,8 @@ class Evaluator(object):
|
||||
else:
|
||||
i = trailer.parent.children.index(trailer)
|
||||
to_evaluate = trailer.parent.children[:i]
|
||||
if to_evaluate[0] == 'await':
|
||||
to_evaluate.pop(0)
|
||||
context_set = context.eval_node(to_evaluate[0])
|
||||
for trailer in to_evaluate[1:]:
|
||||
context_set = eval_trailer(context, context_set, trailer)
|
||||
|
||||
@@ -89,6 +89,10 @@ def evaluate_call_of_leaf(context, leaf, cut_own_trailer=False):
|
||||
base = power.children[0]
|
||||
trailers = power.children[1:cut]
|
||||
|
||||
if base == 'await':
|
||||
base = trailers[0]
|
||||
trailers = trailers[1:]
|
||||
|
||||
values = context.eval_node(base)
|
||||
from jedi.evaluate.syntax_tree import eval_trailer
|
||||
for trailer in trailers:
|
||||
|
||||
@@ -23,3 +23,14 @@ async def x2():
|
||||
async with open('asdf') as f:
|
||||
#? ['readlines']
|
||||
f.readlines
|
||||
|
||||
class A():
|
||||
@staticmethod
|
||||
async def b(c=1, d=2):
|
||||
return 1
|
||||
|
||||
#! 9 ['def b']
|
||||
await A.b()
|
||||
|
||||
#! 11 ['param d=2']
|
||||
await A.b(d=3)
|
||||
|
||||
Reference in New Issue
Block a user