mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
location -> loc abbreviation (#3826)
This commit is contained in:
@@ -25,13 +25,13 @@ static auto HandleDeclNameAndParams(Context& context, State after_name)
|
||||
CARBON_DIAGNOSTIC(ExpectedDeclName, Error,
|
||||
"`{0}` introducer should be followed by a name.",
|
||||
Lex::TokenKind);
|
||||
Lex::TokenIndex location = *context.position();
|
||||
if (context.tokens().GetKind(location) == Lex::TokenKind::FileEnd) {
|
||||
// The end of file is often an especially unhelpful location. If that's
|
||||
// the best we can do here, back up the location to the introducer itself.
|
||||
location = state.token;
|
||||
Lex::TokenIndex token = *context.position();
|
||||
if (context.tokens().GetKind(token) == Lex::TokenKind::FileEnd) {
|
||||
// The end of file is an unhelpful diagnostic location. Instead, use the
|
||||
// introducer token.
|
||||
token = state.token;
|
||||
}
|
||||
context.emitter().Emit(location, ExpectedDeclName,
|
||||
context.emitter().Emit(token, ExpectedDeclName,
|
||||
context.tokens().GetKind(state.token));
|
||||
context.ReturnErrorOnState();
|
||||
context.AddLeafNode(NodeKind::InvalidParse, *context.position(),
|
||||
|
||||
Reference in New Issue
Block a user