Change parsing of statements starting with annotations
If a block statement starts with annotations treat them as they belong to node of the statement rather than to the closest prefix expression #KT-10210 Fixed
This commit is contained in:
@@ -1233,8 +1233,8 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
|
||||
/*
|
||||
* statement
|
||||
* : expression
|
||||
* : declaration
|
||||
* : annotations expression
|
||||
* ;
|
||||
*/
|
||||
private void parseStatement(boolean isScriptTopLevel) {
|
||||
@@ -1244,15 +1244,27 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
}
|
||||
else if (isScriptTopLevel){
|
||||
PsiBuilder.Marker scriptInitializer = mark();
|
||||
parseExpression();
|
||||
parseStatementLevelExpression();
|
||||
scriptInitializer.done(SCRIPT_INITIALIZER);
|
||||
}
|
||||
else {
|
||||
parseExpression();
|
||||
parseStatementLevelExpression();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void parseStatementLevelExpression() {
|
||||
if (at(AT)) {
|
||||
PsiBuilder.Marker expression = mark();
|
||||
myKotlinParsing.parseAnnotations(DEFAULT);
|
||||
parseStatementLevelExpression();
|
||||
expression.done(ANNOTATED_EXPRESSION);
|
||||
return;
|
||||
}
|
||||
|
||||
parseExpression();
|
||||
}
|
||||
|
||||
/*
|
||||
* declaration
|
||||
* : function
|
||||
|
||||
Reference in New Issue
Block a user