99namespace quick_lint_js {
1010void error_collector::report_impl (error_type type, void *error) {
1111 switch (type) {
12- #define QLJS_ERROR_TYPE (name, code, severity, struct_body, format_call ) \
13- case error_type::name: \
14- this ->errors .emplace_back (*reinterpret_cast <const name *>(error)); \
12+ #define QLJS_DIAG_TYPE (name, code, severity, struct_body, format_call ) \
13+ case error_type::name: \
14+ this ->errors .emplace_back (*reinterpret_cast <const name *>(error)); \
1515 break ;
16- QLJS_X_ERROR_TYPES
17- #undef QLJS_ERROR_TYPE
16+ QLJS_X_DIAG_TYPES
17+ #undef QLJS_DIAG_TYPE
1818 }
1919}
2020
21- #define QLJS_ERROR_TYPE (name, code, severity, struct_body, format_call ) \
22- error_collector::error::error (const name &data) \
21+ #define QLJS_DIAG_TYPE (name, code, severity, struct_body, format_call ) \
22+ error_collector::error::error (const name &data) \
2323 : type_(error_type::name), variant_##name##_(std::move(data)) {}
24- QLJS_X_ERROR_TYPES
25- #undef QLJS_ERROR_TYPE
24+ QLJS_X_DIAG_TYPES
25+ #undef QLJS_DIAG_TYPE
2626
2727error_type error_collector::error::type () const noexcept { return this ->type_ ; }
2828
2929const char *error_collector::error::error_code () const noexcept {
3030 switch (this ->type_ ) {
31- #define QLJS_ERROR_TYPE (name, code, severity, struct_body, format_call ) \
32- case error_type::name: \
31+ #define QLJS_DIAG_TYPE (name, code, severity, struct_body, format_call ) \
32+ case error_type::name: \
3333 return code;
34- QLJS_X_ERROR_TYPES
35- #undef QLJS_ERROR_TYPE
34+ QLJS_X_DIAG_TYPES
35+ #undef QLJS_DIAG_TYPE
3636 }
3737 QLJS_UNREACHABLE ();
3838}
@@ -41,7 +41,7 @@ const void *error_collector::error::data() const noexcept {
4141 return &this ->variant_diag_unexpected_token_ ; // Arbitrary member.
4242}
4343
44- #define QLJS_ERROR_TYPE (name, code, severity, struct_body, format_call ) \
44+ #define QLJS_DIAG_TYPE (name, code, severity, struct_body, format_call ) \
4545 template <> \
4646 bool holds_alternative<name>(const error_collector::error &e) noexcept { \
4747 return e.type_ == error_type::name; \
@@ -52,17 +52,17 @@ const void *error_collector::error::data() const noexcept {
5252 QLJS_ASSERT (holds_alternative<name>(e)); \
5353 return e.variant_ ##name##_; \
5454 }
55- QLJS_X_ERROR_TYPES
56- #undef QLJS_ERROR_TYPE
55+ QLJS_X_DIAG_TYPES
56+ #undef QLJS_DIAG_TYPE
5757
5858void PrintTo (const error_collector::error &e, std::ostream *out) {
5959 *out << e.type_ ;
6060}
6161
62- #define QLJS_ERROR_TYPE (name, code, severity, struct_body, format_call ) \
62+ #define QLJS_DIAG_TYPE (name, code, severity, struct_body, format_call ) \
6363 void PrintTo (const name &, std::ostream *out) { *out << #name; }
64- QLJS_X_ERROR_TYPES
65- #undef QLJS_ERROR_TYPE
64+ QLJS_X_DIAG_TYPES
65+ #undef QLJS_DIAG_TYPE
6666}
6767
6868// quick-lint-js finds bugs in JavaScript programs.
0 commit comments