From e9e453f1571acde76f15d7e40a8d1e06cfb8e1b5 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Wed, 4 Jun 2025 22:45:31 +0200 Subject: std: Add assert impl --- std/stdlib.src | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'std') diff --git a/std/stdlib.src b/std/stdlib.src index 004c249..90e28d6 100644 --- a/std/stdlib.src +++ b/std/stdlib.src @@ -1,4 +1,5 @@ extern printf = (*i8, varargs) => void; +extern exit = (i64) => void; /* TODO: This has a bug (with varargs i think) */ let println = (str: *i8, args: varargs) => void { @@ -78,3 +79,12 @@ let iswhitespace = (c: i8) => bool { return false; }; + +let assert = (cond: bool) => void { + if !cond { + println("UNREACHABLE"); + exit(1); + }; + + return; +}; -- cgit 1.4.1