aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-15 19:19:28 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-15 19:19:28 -0500
commita05e224150a5a4bcad5ab1b399b43db8a0e28104 (patch)
treedb8352ab2ca029b95050c78364adc4ac0deb1240 /src/codegen.cpp
parent7293e012d7956b892380517e914108ffadc6941b (diff)
downloadzig-a05e224150a5a4bcad5ab1b399b43db8a0e28104.tar.gz
zig-a05e224150a5a4bcad5ab1b399b43db8a0e28104.zip
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
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index d2662b10d2..d2b2836b0c 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -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);
}