aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-05-25 20:24:19 +0100
committergingerBill <bill@gingerbill.org>2019-05-25 20:24:19 +0100
commit458ec5922e69f105ca92d348e475693dfa252ad0 (patch)
tree0c7db7614a6a3f9d05816e54adc03d82118f06c3 /src/check_stmt.cpp
parentf5fdd031f9b763a2b6a86f2fc536735fc8d7ed5d (diff)
odin query
Output .json file containing information about the program
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 82fc3bc7b..88f1574e8 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -809,6 +809,9 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
}
if (unhandled.count > 0) {
+ begin_error_block();
+ defer (begin_error_block());
+
if (unhandled.count == 1) {
error_no_newline(node, "Unhandled switch case: ");
} else {
@@ -817,11 +820,11 @@ void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
for_array(i, unhandled) {
Entity *f = unhandled[i];
if (i > 0) {
- gb_printf_err(", ");
+ error_line(", ");
}
- gb_printf_err("%.*s", LIT(f->token.string));
+ error_line("%.*s", LIT(f->token.string));
}
- gb_printf_err("\n");
+ error_line("\n");
}
}
}
@@ -1040,13 +1043,13 @@ void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
for_array(i, unhandled) {
Type *t = unhandled[i];
if (i > 0) {
- gb_printf_err(", ");
+ error_line(", ");
}
gbString s = type_to_string(t);
- gb_printf_err("%s", s);
+ error_line("%s", s);
gb_string_free(s);
}
- gb_printf_err("\n");
+ error_line("\n");
}
}
}