Better recovery for parameters without type

This commit is contained in:
Nikolay Krasko
2012-09-18 14:43:21 +04:00
parent f7da4f681c
commit 7c41ec517f
3 changed files with 49 additions and 5 deletions
@@ -980,8 +980,7 @@ public class JetParsing extends AbstractJetParsing {
expect(IDENTIFIER, "Expecting parameter name", TokenSet.create(RPAR, COLON, LBRACE, EQ));
if (at(COLON)) {
advance();
advance(); // COLON
parseTypeRef();
}
setterParameter.done(VALUE_PARAMETER);
@@ -1730,20 +1729,23 @@ public class JetParsing extends AbstractJetParsing {
private boolean parseFunctionParameterRest() {
expect(IDENTIFIER, "Parameter name expected", PARAMETER_NAME_RECOVERY_SET);
boolean noErrors = true;
if (at(COLON)) {
advance(); // COLON
parseTypeRef();
}
else {
error("Parameters must have type annotation");
return false;
errorWithRecovery("Parameters must have type annotation", PARAMETER_NAME_RECOVERY_SET);
noErrors = false;
}
if (at(EQ)) {
advance(); // EQ
myExpressionParsing.parseExpression();
}
return true;
return noErrors;
}
/*