Minor. Extract parsePropertyDelegateOrAssignment

This commit is contained in:
Denis Zharkov
2016-07-07 13:57:29 +03:00
parent 4981b730ef
commit 36a7f31358
@@ -1252,26 +1252,11 @@ public class KotlinParsing extends AbstractKotlinParsing {
parseTypeConstraintsGuarded(typeParametersDeclared); parseTypeConstraintsGuarded(typeParametersDeclared);
if (local) { parsePropertyDelegateOrAssignment();
if (at(BY_KEYWORD)) { if (!local) {
parsePropertyDelegate(); // It's only needed for non-local properties, because in local ones:
} // "val a = 1; b" must not be an infix call of b on "val ...;"
else if (at(EQ)) { consumeIf(SEMICOLON);
advance(); // EQ
myExpressionParsing.parseExpression();
// "val a = 1; b" must not be an infix call of b on "val ...;"
}
}
else {
if (at(BY_KEYWORD)) {
parsePropertyDelegate();
consumeIf(SEMICOLON);
}
else if (at(EQ)) {
advance(); // EQ
myExpressionParsing.parseExpression();
consumeIf(SEMICOLON);
}
AccessorKind accessorKind = parsePropertyGetterOrSetter(null); AccessorKind accessorKind = parsePropertyGetterOrSetter(null);
if (accessorKind != null) { if (accessorKind != null) {
@@ -1291,6 +1276,16 @@ public class KotlinParsing extends AbstractKotlinParsing {
return multiDeclaration ? DESTRUCTURING_DECLARATION : PROPERTY; return multiDeclaration ? DESTRUCTURING_DECLARATION : PROPERTY;
} }
private void parsePropertyDelegateOrAssignment() {
if (at(BY_KEYWORD)) {
parsePropertyDelegate();
}
else if (at(EQ)) {
advance(); // EQ
myExpressionParsing.parseExpression();
}
}
/* /*
* propertyDelegate * propertyDelegate
* : "by" expression * : "by" expression