mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
fixed PY-11058 False positive Statement expected, found statement break
This commit is contained in:
@@ -259,6 +259,7 @@ public class StatementParsing extends Parsing implements ITokenTypeRemapper {
|
||||
PsiBuilder builder = myContext.getBuilder();
|
||||
if (builder.getTokenType() == PyTokenTypes.STATEMENT_BREAK) {
|
||||
builder.advanceLexer();
|
||||
scope.setAfterSemicolon(false);
|
||||
}
|
||||
else if (builder.getTokenType() == PyTokenTypes.SEMICOLON) {
|
||||
if (!scope.isSuite()) {
|
||||
|
||||
2
python/testData/psi/ResetAfterSemicolon.py
Normal file
2
python/testData/psi/ResetAfterSemicolon.py
Normal file
@@ -0,0 +1,2 @@
|
||||
if True:
|
||||
import tmp2; import tmp1
|
||||
24
python/testData/psi/ResetAfterSemicolon.txt
Normal file
24
python/testData/psi/ResetAfterSemicolon.txt
Normal file
@@ -0,0 +1,24 @@
|
||||
PyFile:ResetAfterSemicolon.py
|
||||
PyIfStatement
|
||||
PyIfPartIf
|
||||
PsiElement(Py:IF_KEYWORD)('if')
|
||||
PsiWhiteSpace(' ')
|
||||
PyReferenceExpression: True
|
||||
PsiElement(Py:IDENTIFIER)('True')
|
||||
PsiElement(Py:COLON)(':')
|
||||
PsiWhiteSpace('\n ')
|
||||
PyStatementList
|
||||
PyImportStatement
|
||||
PsiElement(Py:IMPORT_KEYWORD)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
PyImportElement:tmp2
|
||||
PyReferenceExpression: tmp2
|
||||
PsiElement(Py:IDENTIFIER)('tmp2')
|
||||
PsiElement(Py:SEMICOLON)(';')
|
||||
PsiWhiteSpace(' ')
|
||||
PyImportStatement
|
||||
PsiElement(Py:IMPORT_KEYWORD)('import')
|
||||
PsiWhiteSpace(' ')
|
||||
PyImportElement:tmp1
|
||||
PyReferenceExpression: tmp1
|
||||
PsiElement(Py:IDENTIFIER)('tmp1')
|
||||
@@ -378,6 +378,11 @@ public class PythonParsingTest extends ParsingTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-11058
|
||||
public void testResetAfterSemicolon() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void doTest(LanguageLevel languageLevel) {
|
||||
LanguageLevel prev = myLanguageLevel;
|
||||
myLanguageLevel = languageLevel;
|
||||
|
||||
Reference in New Issue
Block a user