From 307a09cba5b02d0016d550d54440d5e650afc88c Mon Sep 17 00:00:00 2001 From: Katajisto Date: Sun, 27 Jul 2025 23:24:52 +0300 Subject: [PATCH] fix a problem with not returning from all control paths in generated code --- src/meta/console_commands.jai | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/meta/console_commands.jai b/src/meta/console_commands.jai index cec98a4..f844a3e 100644 --- a/src/meta/console_commands.jai +++ b/src/meta/console_commands.jai @@ -38,7 +38,6 @@ add_console_commands :: (message: *Message, w: *Workspace) { } } if !is_command then continue; - print("Found console command called: %\n", expression.name); if expression.flags & .SCOPE_FILE { compiler_report(sprint("Command % is file scoped, that is not okay. Commands must be exported.", expression.name), make_location(cast(*Code_Node)expression), .ERROR); @@ -67,7 +66,6 @@ add_console_commands :: (message: *Message, w: *Workspace) { for arg, i : header.arguments { - print("ARG% (%): %\n", i, arg.type_inst.result.type, arg.name); type_tag := arg.type_inst.result.type; arg_name := arg.name; if type_tag == { @@ -101,9 +99,9 @@ add_console_commands :: (message: *Message, w: *Workspace) { for arg_count_min..arg_count { print_to_builder(*builder, "if args.count == % then return sprint(\"\%\", %(%));\n", it, expression.name, get_call_string(it)); } + print_to_builder(*builder, "return \"Something really really weird has happened. Your argument count somehow went trough all the return checks....\";\n"); print_to_builder(*builder, "}\n"); str := builder_to_string(*builder); - print("%\n", str); array_add(*console_commands_to_register, sprint("%", expression.name)); add_build_string(str, w.*); free(str);