mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Use abbreviation "decl" instead of "declaration" (#3382)
Part of switching to the [abbreviations we've decided to use](https://docs.google.com/document/d/1RRYMm42osyqhI2LyjrjockYCutQ5dOf8Abu50kTrkX0/edit?resourcekey=0-kHyqOESbOHmzZphUbtLrTw#heading=h.pph7i5m5un7q). I will rename files in a follow-up PR.
This commit is contained in:
@@ -13,7 +13,7 @@ auto HandleFunctionIntroducer(Context& context) -> void {
|
||||
|
||||
state.state = State::FunctionAfterParameters;
|
||||
context.PushState(state);
|
||||
context.PushState(State::DeclarationNameAndParamsAsRequired, state.token);
|
||||
context.PushState(State::DeclNameAndParamsAsRequired, state.token);
|
||||
}
|
||||
|
||||
auto HandleFunctionAfterParameters(Context& context) -> void {
|
||||
@@ -44,21 +44,20 @@ auto HandleFunctionSignatureFinish(Context& context) -> void {
|
||||
|
||||
switch (context.PositionKind()) {
|
||||
case Lex::TokenKind::Semi: {
|
||||
context.AddNode(NodeKind::FunctionDeclaration, context.Consume(),
|
||||
context.AddNode(NodeKind::FunctionDecl, context.Consume(),
|
||||
state.subtree_start, state.has_error);
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::OpenCurlyBrace: {
|
||||
if (auto decl_context = context.GetDeclarationContext();
|
||||
decl_context == Context::DeclarationContext::Interface ||
|
||||
decl_context == Context::DeclarationContext::NamedConstraint) {
|
||||
if (auto decl_context = context.GetDeclContext();
|
||||
decl_context == Context::DeclContext::Interface ||
|
||||
decl_context == Context::DeclContext::NamedConstraint) {
|
||||
CARBON_DIAGNOSTIC(
|
||||
MethodImplNotAllowed, Error,
|
||||
"Method implementations are not allowed in interfaces.");
|
||||
context.emitter().Emit(*context.position(), MethodImplNotAllowed);
|
||||
context.RecoverFromDeclarationError(state,
|
||||
NodeKind::FunctionDeclaration,
|
||||
/*skip_past_likely_end=*/true);
|
||||
context.RecoverFromDeclError(state, NodeKind::FunctionDecl,
|
||||
/*skip_past_likely_end=*/true);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -73,14 +72,14 @@ auto HandleFunctionSignatureFinish(Context& context) -> void {
|
||||
}
|
||||
default: {
|
||||
if (!state.has_error) {
|
||||
context.EmitExpectedDeclarationSemiOrDefinition(Lex::TokenKind::Fn);
|
||||
context.EmitExpectedDeclSemiOrDefinition(Lex::TokenKind::Fn);
|
||||
}
|
||||
// Only need to skip if we've not already found a new line.
|
||||
bool skip_past_likely_end =
|
||||
context.tokens().GetLine(*context.position()) ==
|
||||
context.tokens().GetLine(state.token);
|
||||
context.RecoverFromDeclarationError(state, NodeKind::FunctionDeclaration,
|
||||
skip_past_likely_end);
|
||||
context.RecoverFromDeclError(state, NodeKind::FunctionDecl,
|
||||
skip_past_likely_end);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user