Skip to content

Commit 2f4ec0a

Browse files
committed
refactor: rename variables in diagnostic.cpp: error -> diag
1 parent d3dfe18 commit 2f4ec0a

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/diagnostic.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// message: while evaluating constexpr function
2626
// diagnostic_info_builder<diag_adjacent_jsx_without_parent>::add
2727
// message: while evaluating constexpr function
28-
// diagnostic_info_for_error<diag_adjacent_jsx_without_parent>::get
28+
// info_for_diagnostic<diag_adjacent_jsx_without_parent>::get
2929
#define DIAGNOSTIC_CONSTEXPR_IF_POSSIBLE /* */
3030
#else
3131
#define DIAGNOSTIC_CONSTEXPR_IF_POSSIBLE constexpr
@@ -46,19 +46,19 @@ constexpr std::uint16_t parse_code_string(const char* code_string) noexcept {
4646
(code_string[4] - '0') * 1);
4747
}
4848

49-
std::array<char, 5> error_code_to_string(std::uint16_t error_code) noexcept {
50-
QLJS_ASSERT(error_code <= 9999);
49+
std::array<char, 5> diag_code_to_string(std::uint16_t diag_code) noexcept {
50+
QLJS_ASSERT(diag_code <= 9999);
5151
return std::array<char, 5>{
5252
'E',
53-
static_cast<char>('0' + ((error_code / 1000) % 10)),
54-
static_cast<char>('0' + ((error_code / 100) % 10)),
55-
static_cast<char>('0' + ((error_code / 10) % 10)),
56-
static_cast<char>('0' + ((error_code / 1) % 10)),
53+
static_cast<char>('0' + ((diag_code / 1000) % 10)),
54+
static_cast<char>('0' + ((diag_code / 100) % 10)),
55+
static_cast<char>('0' + ((diag_code / 10) % 10)),
56+
static_cast<char>('0' + ((diag_code / 1) % 10)),
5757
};
5858
}
5959

6060
// Convert a QLJS_DIAG_TYPE user into a diagnostic_info.
61-
template <class Error>
61+
template <class Diag>
6262
class diagnostic_info_builder {
6363
public:
6464
QLJS_WARNING_PUSH
@@ -127,16 +127,16 @@ constexpr diagnostic_message_arg_info make_diagnostic_message_arg_info(
127127
offset, get_diagnostic_message_arg_type<ArgType>());
128128
}
129129

130-
template <class Error>
131-
struct diagnostic_info_for_error;
130+
template <class Diag>
131+
struct info_for_diagnostic;
132132

133133
#define MAKE_ARGS(...) MAKE_ARGS_N(QLJS_COUNT_ARGS(__VA_ARGS__), __VA_ARGS__)
134134
#define MAKE_ARGS_N(...) MAKE_ARGS_N_(__VA_ARGS__)
135135
#define MAKE_ARGS_N_(count, ...) MAKE_ARGS_##count(__VA_ARGS__)
136136

137-
#define MAKE_ARGS_1(arg0) \
138-
make_diagnostic_message_arg_info<decltype(error_class::arg0)>( \
139-
offsetof(error_class, arg0))
137+
#define MAKE_ARGS_1(arg0) \
138+
make_diagnostic_message_arg_info<decltype(diag_class::arg0)>( \
139+
offsetof(diag_class, arg0))
140140
#define MAKE_ARGS_2(arg0, arg1) MAKE_ARGS_1(arg0), MAKE_ARGS_1(arg1)
141141
#define MAKE_ARGS_3(arg0, arg1, arg2) MAKE_ARGS_2(arg0, arg1), MAKE_ARGS_1(arg2)
142142

@@ -145,8 +145,8 @@ struct diagnostic_info_for_error;
145145

146146
#define QLJS_DIAG_TYPE(name, code, severity, struct_body, format_call) \
147147
template <> \
148-
struct diagnostic_info_for_error<name> { \
149-
using error_class = name; \
148+
struct info_for_diagnostic<name> { \
149+
using diag_class = name; \
150150
\
151151
static DIAGNOSTIC_CONSTEXPR_IF_POSSIBLE diagnostic_info get() noexcept { \
152152
return diagnostic_info_builder<name>(code, severity) \
@@ -160,7 +160,7 @@ QLJS_X_DIAG_TYPES
160160
DIAGNOSTIC_CONSTEXPR_IF_POSSIBLE const diagnostic_info
161161
all_diagnostic_infos[] = {
162162
#define QLJS_DIAG_TYPE(name, code, severity, struct_body, format_call) \
163-
diagnostic_info_for_error<name>::get(),
163+
info_for_diagnostic<name>::get(),
164164
QLJS_X_DIAG_TYPES
165165
#undef QLJS_DIAG_TYPE
166166
};
@@ -170,7 +170,7 @@ const diagnostic_info& get_diagnostic_info(diag_type type) noexcept {
170170
}
171171

172172
std::array<char, 5> diagnostic_info::code_string() const noexcept {
173-
return error_code_to_string(this->code);
173+
return diag_code_to_string(this->code);
174174
}
175175

176176
QLJS_WARNING_PUSH

0 commit comments

Comments
 (0)