about summary refs log tree commit diff
path: root/std/stdlib.src
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-06-04 22:45:31 +0200
committerBaitinq <[email protected]>2025-06-04 22:45:31 +0200
commite9e453f1571acde76f15d7e40a8d1e06cfb8e1b5 (patch)
tree64762e6b8000ebca047aed56721a47c190c1ccb6 /std/stdlib.src
parentBootstrap: Codegen: Initialize all targets (diff)
downloadinterpreter-e9e453f1571acde76f15d7e40a8d1e06cfb8e1b5.tar.gz
interpreter-e9e453f1571acde76f15d7e40a8d1e06cfb8e1b5.tar.bz2
interpreter-e9e453f1571acde76f15d7e40a8d1e06cfb8e1b5.zip
std: Add assert impl
Diffstat (limited to '')
-rw-r--r--std/stdlib.src10
1 files changed, 10 insertions, 0 deletions
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;
+};