Fix an async funcdef issue, fixes 1092.

This commit is contained in:
Dave Halter
2018-04-24 00:41:18 +02:00
parent 4075c384e6
commit 8494164b22
2 changed files with 12 additions and 1 deletions

View File

@@ -88,10 +88,12 @@ def get_flow_branch_keyword(flow_node, node):
keyword = first_leaf
return 0
def get_statement_of_position(node, pos):
for c in node.children:
if c.start_pos <= pos <= c.end_pos:
if c.type not in ('decorated', 'simple_stmt', 'suite') \
if c.type not in ('decorated', 'simple_stmt', 'suite',
'async_stmt', 'async_funcdef') \
and not isinstance(c, (tree.Flow, tree.ClassOrFunc)):
return c
else:

View File

@@ -73,3 +73,12 @@ async def wrapper():
asgen().__ane
#? []
asgen().mro
# Normal completion (#1092)
normal_var1 = 42
async def foo():
normal_var2 = False
#? ['normal_var1', 'normal_var2']
normal_var