Fixed parsing decorated async functions and 'await' expressions inside them (PY-16094)

This commit is contained in:
Andrey Vlasovskikh
2015-09-08 17:44:21 +03:00
parent ef0fddb589
commit caf85e8e71
4 changed files with 94 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
@foo
async def bar():
await x
return 0
@baz(x, y)
async def quux():
return await x
+69
View File
@@ -0,0 +1,69 @@
PyFile:DecoratedAsyncDef.py
PyFunction('bar')
PyDecoratorList
PyDecorator: @foo
PsiElement(Py:AT)('@')
PyReferenceExpression: foo
PsiElement(Py:IDENTIFIER)('foo')
PyArgumentList
<empty list>
PsiWhiteSpace('\n')
PsiElement(Py:ASYNC_KEYWORD)('async')
PsiWhiteSpace(' ')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('bar')
PyParameterList
PsiElement(Py:LPAR)('(')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyExpressionStatement
PyPrefixExpression
PsiElement(Py:AWAIT_KEYWORD)('await')
PsiWhiteSpace(' ')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiWhiteSpace('\n ')
PyReturnStatement
PsiElement(Py:RETURN_KEYWORD)('return')
PsiWhiteSpace(' ')
PyNumericLiteralExpression
PsiElement(Py:INTEGER_LITERAL)('0')
PsiWhiteSpace('\n\n\n')
PyFunction('quux')
PyDecoratorList
PyDecorator: @baz
PsiElement(Py:AT)('@')
PyReferenceExpression: baz
PsiElement(Py:IDENTIFIER)('baz')
PyArgumentList
PsiElement(Py:LPAR)('(')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')
PsiElement(Py:COMMA)(',')
PsiWhiteSpace(' ')
PyReferenceExpression: y
PsiElement(Py:IDENTIFIER)('y')
PsiElement(Py:RPAR)(')')
PsiWhiteSpace('\n')
PsiElement(Py:ASYNC_KEYWORD)('async')
PsiWhiteSpace(' ')
PsiElement(Py:DEF_KEYWORD)('def')
PsiWhiteSpace(' ')
PsiElement(Py:IDENTIFIER)('quux')
PyParameterList
PsiElement(Py:LPAR)('(')
PsiElement(Py:RPAR)(')')
PsiElement(Py:COLON)(':')
PsiWhiteSpace('\n ')
PyStatementList
PyReturnStatement
PsiElement(Py:RETURN_KEYWORD)('return')
PsiWhiteSpace(' ')
PyPrefixExpression
PsiElement(Py:AWAIT_KEYWORD)('await')
PsiWhiteSpace(' ')
PyReferenceExpression: x
PsiElement(Py:IDENTIFIER)('x')