From 458ec5922e69f105ca92d348e475693dfa252ad0 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 25 May 2019 20:24:19 +0100 Subject: odin query Output .json file containing information about the program --- src/check_stmt.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/check_stmt.cpp') 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"); } } } -- cgit v1.2.3