mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-20682 Fixed: await something() as function argument is not recognized by syntax analyzer
Copy `async` flag in ParsingScope.withSuite
This commit is contained in:
@@ -43,6 +43,7 @@ public class ParsingScope {
|
||||
public ParsingScope withSuite() {
|
||||
final ParsingScope result = copy();
|
||||
result.mySuite = true;
|
||||
result.myAsync = myAsync;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
async def y(a1, a2):
|
||||
for i in range(10): a1.foo(await a1.x(a2))
|
||||
@@ -0,0 +1,63 @@
|
||||
PyFile:AwaitOnTheSameLineAsFor.py
|
||||
PyFunction('y')
|
||||
PsiElement(Py:ASYNC_KEYWORD)('async')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:DEF_KEYWORD)('def')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IDENTIFIER)('y')
|
||||
PyParameterList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNamedParameter('a1')
|
||||
PsiElement(Py:IDENTIFIER)('a1')
|
||||
PsiElement(Py:COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
PyNamedParameter('a2')
|
||||
PsiElement(Py:IDENTIFIER)('a2')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyForStatement
|
||||
PyForPart
|
||||
PsiElement(Py:FOR_KEYWORD)('for')
|
||||
PsiWhiteSpace(' ')
|
||||
PyTargetExpression: i
|
||||
PsiElement(Py:IDENTIFIER)('i')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(Py:IN_KEYWORD)('in')
|
||||
PsiWhiteSpace(' ')
|
||||
PyCallExpression: range
|
||||
PyReferenceExpression: range
|
||||
PsiElement(Py:IDENTIFIER)('range')
|
||||
PyArgumentList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyNumericLiteralExpression
|
||||
PsiElement(Py:INTEGER_LITERAL)('10')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PyStatementList
|
||||
PyExpressionStatement
|
||||
PyCallExpression: a1.foo
|
||||
PyReferenceExpression: foo
|
||||
PyReferenceExpression: a1
|
||||
PsiElement(Py:IDENTIFIER)('a1')
|
||||
PsiElement(Py:DOT)('.')
|
||||
PsiElement(Py:IDENTIFIER)('foo')
|
||||
PyArgumentList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyPrefixExpression
|
||||
PsiElement(Py:AWAIT_KEYWORD)('await')
|
||||
PsiWhiteSpace(' ')
|
||||
PyCallExpression: a1.x
|
||||
PyReferenceExpression: x
|
||||
PyReferenceExpression: a1
|
||||
PsiElement(Py:IDENTIFIER)('a1')
|
||||
PsiElement(Py:DOT)('.')
|
||||
PsiElement(Py:IDENTIFIER)('x')
|
||||
PyArgumentList
|
||||
PsiElement(Py:LPAR)('(')
|
||||
PyReferenceExpression: a2
|
||||
PsiElement(Py:IDENTIFIER)('a2')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
PsiElement(Py:RPAR)(')')
|
||||
@@ -534,6 +534,11 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest(LanguageLevel.PYTHON36);
|
||||
}
|
||||
|
||||
// PY-20682
|
||||
public void testAwaitOnTheSameLineAsFor() {
|
||||
doTest(LanguageLevel.PYTHON35);
|
||||
}
|
||||
|
||||
public void doTest(LanguageLevel languageLevel) {
|
||||
LanguageLevel prev = myLanguageLevel;
|
||||
myLanguageLevel = languageLevel;
|
||||
|
||||
Reference in New Issue
Block a user