Skip to content

Commit 05f0a6e

Browse files
committed
chore: Simplify cached ast declarations
1 parent 97c2397 commit 05f0a6e

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

src/parser/cxx/parser.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -499,22 +499,14 @@ class Parser final {
499499

500500
std::vector<FunctionDefinitionAST*> pendingFunctionDefinitions_;
501501

502-
std::unordered_map<SourceLocation,
503-
std::tuple<SourceLocation, ClassSpecifierAST*, bool>>
504-
class_specifiers_;
505-
506-
std::unordered_map<
507-
SourceLocation,
508-
std::tuple<SourceLocation, ElaboratedTypeSpecifierAST*, bool>>
509-
elaborated_type_specifiers_;
510-
511-
std::unordered_map<SourceLocation,
512-
std::tuple<SourceLocation, TemplateArgumentAST*, bool>>
513-
template_arguments_;
514-
515-
std::unordered_map<SourceLocation,
516-
std::tuple<SourceLocation, NestedNameSpecifierAST*, bool>>
517-
nested_name_specifiers_;
502+
template <typename T>
503+
using CachedAST =
504+
std::unordered_map<SourceLocation, std::tuple<SourceLocation, T*, bool>>;
505+
506+
CachedAST<ClassSpecifierAST> class_specifiers_;
507+
CachedAST<ElaboratedTypeSpecifierAST> elaborated_type_specifiers_;
508+
CachedAST<TemplateArgumentAST> template_arguments_;
509+
CachedAST<NestedNameSpecifierAST> nested_name_specifiers_;
518510
};
519511

520512
} // namespace cxx

0 commit comments

Comments
 (0)