mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-06 10:54:49 +01:00
Add KeywordModifierSet helper for conversion to (likely SemIR) enums (#4290)
(based on https://github.com/carbon-language/carbon-lang/pull/4272#discussion_r1751001345) Could haggle over the name "ToEnum" probably avoids the debate over "enumeration" (the type being returned) v "enumerator" (the value being returned) --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
6311552fcc
commit
b8f61a712e
@@ -201,11 +201,10 @@ static auto BuildClassDecl(Context& context, Parse::AnyClassDeclId node_id,
|
||||
context.TODO(node_id, "extern library");
|
||||
}
|
||||
auto inheritance_kind =
|
||||
introducer.modifier_set.HasAnyOf(KeywordModifierSet::Abstract)
|
||||
? SemIR::Class::Abstract
|
||||
: introducer.modifier_set.HasAnyOf(KeywordModifierSet::Base)
|
||||
? SemIR::Class::Base
|
||||
: SemIR::Class::Final;
|
||||
introducer.modifier_set.ToEnum<SemIR::Class::InheritanceKind>()
|
||||
.Case(KeywordModifierSet::Abstract, SemIR::Class::Abstract)
|
||||
.Case(KeywordModifierSet::Base, SemIR::Class::Base)
|
||||
.Default(SemIR::Class::Final);
|
||||
|
||||
auto decl_block_id = context.inst_block_stack().Pop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user