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:
josh11b
2023-11-10 10:43:25 +00:00
committed by GitHub
parent 11ca083855
commit 5020fdb3be
229 changed files with 565 additions and 601 deletions
+10 -11
View File
@@ -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;
}
}