diff options
| author | gingerBill <bill@gingerbill.org> | 2018-10-13 13:19:52 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-10-13 13:19:52 +0100 |
| commit | 42b42db67544f6037cfb3aac2d486161bc0e2147 (patch) | |
| tree | 5b7bc7e04d2e59d9ca1beb7f8e774336cb4a0eb3 /core/runtime | |
| parent | 73e9dbbf8c4a68dc6c512eb2de568d59df046494 (diff) | |
Add `unimplemented` and `unreachable` procedures; make `os.exit` a diverging procedure
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core.odin | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin index fff510dfb..3b88a0412 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -590,6 +590,28 @@ panic :: proc "contextless" (message: string, loc := #caller_location) -> ! { p("Panic", message, loc); } +@(builtin) +unimplemented :: proc "contextless" (message := "", loc := #caller_location) -> ! { + p := context.assertion_failure_proc; + if p == nil { + p = default_assertion_failure_proc; + } + p("not yet implemented", message, loc); +} + +@(builtin) +unreachable :: proc "contextless" (message := "", loc := #caller_location) -> ! { + p := context.assertion_failure_proc; + if p == nil { + p = default_assertion_failure_proc; + } + if message != "" { + p("internal error", message, loc); + } else { + p("internal error", "entered unreachable code", loc); + } +} + // Dynamic Array |