Skip to content

Commit 9fef214

Browse files
committed
Optimize buffering_error_reporter::copy_into
Optimize copy_into for binary size by calling report_impl instead of using a switch statement. On my machine, this shrinks quick-lint-js-vscode-node_darwin-x64.node from 866 KiB to 858 KiB. This commit should not change behavior.
1 parent 8068edd commit 9fef214

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/buffering-error-reporter.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,7 @@ void buffering_error_reporter::report_impl(error_type type, void *error) {
5656

5757
void buffering_error_reporter::copy_into(error_reporter *other) const {
5858
for (impl::any_error &error : this->impl_->errors_) {
59-
switch (error.type) {
60-
#define QLJS_ERROR_TYPE(name, code, struct_body, format) \
61-
case error_type::name: \
62-
other->report(error.error.name); \
63-
break;
64-
QLJS_X_ERROR_TYPES
65-
#undef QLJS_ERROR_TYPE
66-
}
59+
other->report_impl(error.type, &error.error);
6760
}
6861
}
6962

0 commit comments

Comments
 (0)