aboutsummaryrefslogtreecommitdiff
path: root/lib/DATS/init.dats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-08-06 17:44:45 +0200
committerXander <xander@biltopia.org>2023-08-06 17:44:45 +0200
commitcef3f6bdddfe768e7a1a84edcec76c11c1634941 (patch)
treea7681996224d1d3bf6eeda8657ac500ac061c2d5 /lib/DATS/init.dats
parent272a40095e7c3f694f010d074ab54b326730009e (diff)
downloadats-os-cef3f6bdddfe768e7a1a84edcec76c11c1634941.tar.xz
ats-os-cef3f6bdddfe768e7a1a84edcec76c11c1634941.zip
Implemented panic
Diffstat (limited to 'lib/DATS/init.dats')
-rw-r--r--lib/DATS/init.dats23
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/DATS/init.dats b/lib/DATS/init.dats
index cfdc12e..c2ae39d 100644
--- a/lib/DATS/init.dats
+++ b/lib/DATS/init.dats
@@ -1,5 +1,7 @@
#include "share/atspre_staload.hats"
staload "lib/SATS/init.sats"
+staload "lib/SATS/panic.sats"
+staload UN = "prelude/SATS/unsafe.sats"
#define ATS_DYNLOADFLAG 0
@@ -20,26 +22,33 @@ in
prval () = opt_some p->obj
in
end
+ else
+ panic("Not initialized")
end
-implement{vt} exec_void$fwork (v) = ()
+implement{vt} exec_void$fwork (v) = panic("Not overloaded")
-implement{vt} {a} exec (r,default) = let
+implement{vt} {a} exec (r) = let
val (vbox pf | p) = ref_get_viewptr{initializable vt}(r)
in
if p->initialized then
let
prval () = opt_unsome p->obj
- val a = exec$fwork (p->obj,default)
+ val out = exec$fwork<vt><a> (p->obj)
prval () = opt_some p->obj
in
- a
+ out
end
- else
- default
+ else (
+ panic("Not inialized");
+ $UN.ptr0_get<a>(the_null_ptr)
+ )
end
-implement{vt} {a} exec$fwork (v,default) = default
+implement{vt} {a} exec$fwork (v) = (
+ (panic("Not overloaded"));
+ $UN.ptr0_get<a>(the_null_ptr)
+)
implement{vt} initialize (r) = let
val (vbox pf | p) = ref_get_viewptr{initializable vt}(r)