Clean up some misc toolchain braced inits. (#4013)

Following up on #4012 and #4009, clean scattered cases which could be
making better use of designated initializers.
This commit is contained in:
Jon Ross-Perkins authored and GitHub committed 2024-05-31 23:23:57 +00:00
1 parent 3c01ee69ed
commit 517a416852
16 files changed
+85 -56

No files matched your search

+12 -6
View File
@@ -59,18 +59,24 @@ struct DeclIntroducerInfo {
static constexpr auto DeclIntroducers = [] {
DeclIntroducerInfo introducers[] = {
#define CARBON_TOKEN(Name) \
{DeclIntroducerKind::Unrecognized, NodeKind::InvalidParse, State::Invalid},
#define CARBON_TOKEN(Name) \
{.introducer_kind = DeclIntroducerKind::Unrecognized, \
.node_kind = NodeKind::InvalidParse, \
.state = State::Invalid},
#include "toolchain/lex/token_kind.def"
};
auto set = [&](Lex::TokenKind token_kind, NodeKind node_kind, State state) {
introducers[token_kind.AsInt()] = {DeclIntroducerKind::NonPackagingDecl,
node_kind, state};
introducers[token_kind.AsInt()] = {
.introducer_kind = DeclIntroducerKind::NonPackagingDecl,
.node_kind = node_kind,
.state = state};
};
auto set_packaging = [&](Lex::TokenKind token_kind, NodeKind node_kind,
State state) {
introducers[token_kind.AsInt()] = {DeclIntroducerKind::PackagingDecl,
node_kind, state};
introducers[token_kind.AsInt()] = {
.introducer_kind = DeclIntroducerKind::PackagingDecl,
.node_kind = node_kind,
.state = state};
};
set(Lex::TokenKind::Adapt, NodeKind::AdaptIntroducer,