mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Refactor KeywordModifierSet to provide a class API (#4003)
This is primarily to avoid the use of `!!` in code, trying not to create too much code as a result (obviously still a net increase). Also refactoring to its own file to make the enum easier to find. Note, NodeCategory does similar, I might propose similar there if everyone's good with the API. However, that's just two, so creating something like enum_base felt like too much.
This commit is contained in:
@@ -229,18 +229,18 @@ static auto BuildFunctionDecl(Context& context,
|
||||
// Process modifiers.
|
||||
auto modifiers = DiagnoseModifiers(context, is_definition,
|
||||
name_context.enclosing_scope_id);
|
||||
if (!!(modifiers & KeywordModifierSet::Access)) {
|
||||
if (modifiers.HasAnyOf(KeywordModifierSet::Access)) {
|
||||
context.TODO(context.decl_state_stack().innermost().modifier_node_id(
|
||||
ModifierOrder::Access),
|
||||
"access modifier");
|
||||
}
|
||||
bool is_extern = !!(modifiers & KeywordModifierSet::Extern);
|
||||
if (!!(modifiers & KeywordModifierSet::Method)) {
|
||||
bool is_extern = modifiers.HasAnyOf(KeywordModifierSet::Extern);
|
||||
if (modifiers.HasAnyOf(KeywordModifierSet::Method)) {
|
||||
context.TODO(context.decl_state_stack().innermost().modifier_node_id(
|
||||
ModifierOrder::Decl),
|
||||
"method modifier");
|
||||
}
|
||||
if (!!(modifiers & KeywordModifierSet::Interface)) {
|
||||
if (modifiers.HasAnyOf(KeywordModifierSet::Interface)) {
|
||||
// TODO: Once we are saving the modifiers for a function, add check that
|
||||
// the function may only be defined if it is marked `default` or `final`.
|
||||
context.TODO(context.decl_state_stack().innermost().modifier_node_id(
|
||||
|
||||
Reference in New Issue
Block a user