Blocks until the compiler has a message for an intercepted workspace, and returns it. Check kind and cast to the matching Message_* type. The last message of a build is .COMPLETE.
#run {
w := compiler_create_workspace("messages");
options := get_build_options(w);
options.output_type = .NO_OUTPUT;
set_build_options(options, w);
add_build_string("main :: () {}", w);
compiler_begin_intercept(w);
files := 0;
while true {
message := compiler_wait_for_message();
if message.kind == .FILE files += 1;
if message.kind == .COMPLETE break;
}
compiler_end_intercept(w);
assert(files > 0);
}
main :: () {}compiler_wait_for_message :: () -> *Message