Merge branch 'trunk' into NumBytesTo

This commit is contained in:
Folkert de Vries 2021-08-20 11:32:20 +02:00 committed by GitHub
commit 86d46825aa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 748 additions and 874 deletions

View file

@ -105,6 +105,14 @@ comptime {
exportStrFn(str.fromUtf8RangeC, "from_utf8_range");
}
// Utils
const utils = @import("utils.zig");
comptime {
exportUtilsFn(utils.test_panic, "test_panic");
@export(utils.panic, .{ .name = "roc_builtins.utils." ++ "panic", .linkage = .Weak });
}
// Export helpers - Must be run inside a comptime
fn exportBuiltinFn(comptime func: anytype, comptime func_name: []const u8) void {
@export(func, .{ .name = "roc_builtins." ++ func_name, .linkage = .Strong });
@ -125,6 +133,10 @@ fn exportDecFn(comptime func: anytype, comptime func_name: []const u8) void {
exportBuiltinFn(func, "dec." ++ func_name);
}
fn exportUtilsFn(comptime func: anytype, comptime func_name: []const u8) void {
exportBuiltinFn(func, "utils." ++ func_name);
}
// Custom panic function, as builtin Zig version errors during LLVM verification
pub fn panic(message: []const u8, stacktrace: ?*std.builtin.StackTrace) noreturn {
std.debug.print("{s}: {?}", .{ message, stacktrace });