mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-25 13:51:10 +00:00
Refactor NodeCategory to provide a class API (#4004)
Mirroring #4003 for NodeCategory. Note we template a lot more on NodeCategory's enum, so this is a slightly more awkward delta. Also, switch from Enum in KeywordModifierSet to RawEnumType for consistency with EnumBase. The templating on NodeCategory had me thinking about that more.
This commit is contained in:
1 parent
419d2e39d8
commit
cda5f66d22
10 files changed
+79
-58
No files matched your search
@@ -96,7 +96,7 @@ static auto NodeIdInCategoryAccept(NodeCategory category, const Tree* tree,
|
||||
const Tree::SiblingIterator& it,
|
||||
Tree::SiblingIterator end,
|
||||
ErrorBuilder* trace) -> bool {
|
||||
if (it == end || !(tree->node_kind(*it).category() & category)) {
|
||||
if (it == end || !tree->node_kind(*it).category().HasAnyOf(category)) {
|
||||
if (trace) {
|
||||
*trace << "NodeIdInCategory " << category << " error: ";
|
||||
if (it == end) {
|
||||
@@ -115,7 +115,7 @@ static auto NodeIdInCategoryAccept(NodeCategory category, const Tree* tree,
|
||||
}
|
||||
|
||||
// Extract a `NodeIdInCategory<Category>` as a single child.
|
||||
template <NodeCategory Category>
|
||||
template <NodeCategory::RawEnumType Category>
|
||||
struct Extractable<NodeIdInCategory<Category>> {
|
||||
static auto Extract(const Tree* tree, Tree::SiblingIterator& it,
|
||||
Tree::SiblingIterator end, ErrorBuilder* trace)
|
||||
|
||||
Reference in new issue
Block a user