Fix parsing variable declaration in when subject
- parse destructuring declarations - parse annotations on variable declaration in when subject
This commit is contained in:
@@ -849,14 +849,16 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
||||
if (at(LPAR)) {
|
||||
advanceAt(LPAR);
|
||||
|
||||
PsiBuilder.Marker property = mark();
|
||||
PsiBuilder.Marker atWhenStart = mark();
|
||||
myKotlinParsing.parseModifierList(DEFAULT, TokenSet.create(EQ, RPAR));
|
||||
if (at(VAL_KEYWORD) || at(VAR_KEYWORD)) {
|
||||
myKotlinParsing.parseLocalProperty(false);
|
||||
property.done(PROPERTY);
|
||||
IElementType declType = myKotlinParsing.parseProperty(KotlinParsing.PropertyParsingMode.LOCAL);
|
||||
|
||||
atWhenStart.done(declType);
|
||||
atWhenStart.setCustomEdgeTokenBinders(PrecedingDocCommentsBinder.INSTANCE, TrailingCommentsBinder.INSTANCE);
|
||||
}
|
||||
else {
|
||||
property.rollbackTo();
|
||||
atWhenStart.drop();
|
||||
parseExpression();
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,8 @@ public class KtDestructuringDeclarationEntry extends KtNamedDeclarationNotStubbe
|
||||
@NotNull
|
||||
private ASTNode getParentNode() {
|
||||
ASTNode parent = getNode().getTreeParent();
|
||||
assert parent.getElementType() == KtNodeTypes.DESTRUCTURING_DECLARATION;
|
||||
assert parent.getElementType() == KtNodeTypes.DESTRUCTURING_DECLARATION :
|
||||
"parent is " + parent.getElementType();
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user