Minor. Cleanup KotlinParsing code
This commit is contained in:
@@ -1054,20 +1054,18 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
advance(); // ARROW
|
advance(); // ARROW
|
||||||
paramsFound = true;
|
paramsFound = true;
|
||||||
}
|
}
|
||||||
else {
|
else if (at(IDENTIFIER) || at(COLON)) {
|
||||||
if (at(IDENTIFIER) || at(COLON)) {
|
// Try to parse a simple name list followed by an ARROW
|
||||||
// Try to parse a simple name list followed by an ARROW
|
// {a -> ...}
|
||||||
// {a -> ...}
|
// {a, b -> ...}
|
||||||
// {a, b -> ...}
|
PsiBuilder.Marker rollbackMarker = mark();
|
||||||
PsiBuilder.Marker rollbackMarker = mark();
|
IElementType nextToken = lookahead(1);
|
||||||
IElementType nextToken = lookahead(1);
|
boolean preferParamsToExpressions = (nextToken == COMMA || nextToken == COLON);
|
||||||
boolean preferParamsToExpressions = (nextToken == COMMA || nextToken == COLON);
|
parseFunctionLiteralParameterList();
|
||||||
parseFunctionLiteralShorthandParameterList();
|
|
||||||
|
|
||||||
paramsFound = preferParamsToExpressions ?
|
paramsFound = preferParamsToExpressions ?
|
||||||
rollbackOrDrop(rollbackMarker, ARROW, "An -> is expected", RBRACE) :
|
rollbackOrDrop(rollbackMarker, ARROW, "An -> is expected", RBRACE) :
|
||||||
rollbackOrDropAt(rollbackMarker, ARROW);
|
rollbackOrDropAt(rollbackMarker, ARROW);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!paramsFound && preferBlock) {
|
if (!paramsFound && preferBlock) {
|
||||||
@@ -1148,15 +1146,12 @@ public class KotlinExpressionParsing extends AbstractKotlinParsing {
|
|||||||
/*
|
/*
|
||||||
* (SimpleName (":" type)?){","}
|
* (SimpleName (":" type)?){","}
|
||||||
*/
|
*/
|
||||||
private void parseFunctionLiteralShorthandParameterList() {
|
private void parseFunctionLiteralParameterList() {
|
||||||
PsiBuilder.Marker parameterList = mark();
|
PsiBuilder.Marker parameterList = mark();
|
||||||
|
|
||||||
while (!eof()) {
|
while (!eof()) {
|
||||||
PsiBuilder.Marker parameter = mark();
|
PsiBuilder.Marker parameter = mark();
|
||||||
|
|
||||||
// int parameterNamePos = matchTokenStreamPredicate(new LastBefore(new At(IDENTIFIER), new AtOffset(doubleArrowPos)));
|
|
||||||
// createTruncatedBuilder(parameterNamePos).parseModifierList(MODIFIER_LIST, false);
|
|
||||||
|
|
||||||
if (at(COLON)) {
|
if (at(COLON)) {
|
||||||
error("Expecting parameter name");
|
error("Expecting parameter name");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user