[fine] Even more resilience, I can stop now

Also fix a bug, could not return from a method OOPS
This commit is contained in:
John Doty 2024-02-01 06:35:43 -08:00
parent 7f30d0ccc3
commit f7acfd588d
3 changed files with 9 additions and 2 deletions

View file

@ -675,6 +675,13 @@ fn return_type(p: &mut CParser) {
p.expect_start(TokenKind::Arrow);
type_expr(p);
if !p.at(TokenKind::LeftBrace) {
p.error("expected a block after a return type");
while !p.at_any(STATEMENT_RECOVERY) && !p.eof() {
p.advance();
}
}
p.end(m, TreeKind::ReturnType);
}