mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor diagnostics out of parser_context.h (#2834)
This is addressing an issue left behind by the context switch, removing a few diagnostics that had been in the header rather than figuring out proper homes. I'm splitting one for semis a little further, sharing one, and then the other two are actually able to be moved into more specific homes as-is (one is only used in one place, clearly an oversight that it wasn't there already).
This commit is contained in:
@@ -52,7 +52,10 @@ auto ParserHandleVarFinishAsSemicolon(ParserContext& context) -> void {
|
||||
if (context.PositionIs(TokenKind::Semi)) {
|
||||
end_token = context.Consume();
|
||||
} else {
|
||||
context.emitter().Emit(*context.position(), ExpectedSemiAfterExpression);
|
||||
// TODO: Disambiguate between statement and member declaration.
|
||||
CARBON_DIAGNOSTIC(ExpectedSemiAfterVar, Error,
|
||||
"Expected `;` to terminate `var` declaration.");
|
||||
context.emitter().Emit(*context.position(), ExpectedSemiAfterVar);
|
||||
state.has_error = true;
|
||||
if (auto semi_token = context.SkipPastLikelyEnd(state.token)) {
|
||||
end_token = *semi_token;
|
||||
|
||||
Reference in New Issue
Block a user