mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-19036 Fixed: Using await in a non-asynchronous nested function not marked as a syntax error
Don't inherit async flag in ParsingScope, pass async flag to function parsing
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import asyncio
|
||||
|
||||
|
||||
async def connect():
|
||||
def callback():
|
||||
return await asyncio.sleep(5)
|
||||
|
||||
return await asyncio.sleep(5)
|
||||
@@ -0,0 +1,68 @@
|
||||
PyFile:AwaitInNonAsyncNestedFunction.py
|
||||
PyImportStatement
|
||||
PsiElement(Py:IMPORT_KEYWORD)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
PyImportElement:asyncio
|
||||
PyReferenceExpression: asyncio
|
||||
PsiElement(Py:IDENTIFIER)('asyncio')
|
||||
PsiWhiteSpace('\n\n\n')
|
||||
PyFunction('connect')
|
||||
PsiElement(Py:ASYNC_KEYWORD)('async')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('connect')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyFunction('callback')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('callback')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyReturnStatement
|
||||
PsiElement(Py:RETURN_KEYWORD)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: await
|
||||
PsiElement(Py:IDENTIFIER)('await')
|
||||
PsiErrorElement:End of statement expected
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PyExpressionStatement
|
||||
PyCallExpression: asyncio.sleep
|
||||
PyReferenceExpression: sleep
|
||||
PyReferenceExpression: asyncio
|
||||
PsiElement(Py:IDENTIFIER)('asyncio')
|
||||
PsiElement(Py:DOT)('.')
|
||||
PsiElement(Py:IDENTIFIER)('sleep')
|
||||
PyArgumentList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('5')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiWhiteSpace('\n\n ')
|
||||
PyReturnStatement
|
||||
PsiElement(Py:RETURN_KEYWORD)('return')
|
||||
PsiWhiteSpace(' ')
|
||||
PyPrefixExpression
|
||||
PsiElement(Py:AWAIT_KEYWORD)('await')
|
||||
PsiWhiteSpace(' ')
|
||||
PyCallExpression: asyncio.sleep
|
||||
PyReferenceExpression: sleep
|
||||
PyReferenceExpression: asyncio
|
||||
PsiElement(Py:IDENTIFIER)('asyncio')
|
||||
PsiElement(Py:DOT)('.')
|
||||
PsiElement(Py:IDENTIFIER)('sleep')
|
||||
PyArgumentList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('5')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
Reference in New Issue
Block a user