mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
If only warnings exist on print_all_errors, next time it is called, clear the error list.
This is mostly only syntax errors too
This commit is contained in:
@@ -672,7 +672,20 @@ gb_internal int error_value_cmp(void const *a, void const *b) {
|
|||||||
return token_pos_cmp(x->pos, y->pos);
|
return token_pos_cmp(x->pos, y->pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gb_internal bool errors_already_printed = false;
|
||||||
|
|
||||||
gb_internal void print_all_errors(void) {
|
gb_internal void print_all_errors(void) {
|
||||||
|
if (errors_already_printed) {
|
||||||
|
if (global_error_collector.warning_count.load() == global_error_collector.error_values.count) {
|
||||||
|
for (ErrorValue &ev : global_error_collector.error_values) {
|
||||||
|
array_free(&ev.msg);
|
||||||
|
}
|
||||||
|
array_clear(&global_error_collector.error_values);
|
||||||
|
errors_already_printed = false;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto const &escape_char = [](gbString res, u8 c) -> gbString {
|
auto const &escape_char = [](gbString res, u8 c) -> gbString {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '\n': res = gb_string_append_length(res, "\\n", 2); break;
|
case '\n': res = gb_string_append_length(res, "\\n", 2); break;
|
||||||
@@ -827,4 +840,6 @@ gb_internal void print_all_errors(void) {
|
|||||||
}
|
}
|
||||||
gbFile *f = gb_file_get_standard(gbFileStandard_Error);
|
gbFile *f = gb_file_get_standard(gbFileStandard_Error);
|
||||||
gb_file_write(f, res, gb_string_length(res));
|
gb_file_write(f, res, gb_string_length(res));
|
||||||
|
|
||||||
|
errors_already_printed = true;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user