typecheck the panic function

this adds the prototype of panic to @import("builtin")
and then uses it to do an implicit cast of the panic
function to this prototype, rather than redoing all the
implicit cast logic.

closes #1894
closes #1895
This commit is contained in:
Andrew Kelley
2019-02-15 19:19:28 -05:00
parent 7293e012d7
commit a05e224150
7 changed files with 50 additions and 48 deletions

View File

@@ -7144,6 +7144,8 @@ Buf *codegen_generate_builtin_source(CodeGen *g) {
" instruction_addresses: []usize,\n"
"};\n\n");
buf_append_str(contents, "pub const PanicFn = fn([]const u8, ?*StackTrace) noreturn;\n\n");
const char *cur_os = nullptr;
{
buf_appendf(contents, "pub const Os = enum {\n");
@@ -7913,6 +7915,8 @@ static void gen_root_source(CodeGen *g) {
}
}
typecheck_panic_fn(g, g->panic_tld_fn, g->panic_fn);
report_errors_and_maybe_exit(g);
}