1--- A checked index or range is outside its valid extent.
2---
3--- One of the compiler-check reasons. Their representation is the ordinary
4--- nonzero atom carrier; compare identities, never assumed integer codes.
5public out_of_range: atom
6--- A checked arithmetic operation cannot represent its result.
7public overflow: atom
8--- A checked conversion cannot represent the source value in its target type.
9public bad_conversion: atom
10--- Execution reached a path declared unreachable.
11public unreachable: atom
12--- A stack switch found the stack pointer below its limit, or a stack was
13--- too small to prepare (D451).
14public stack_exhausted: atom
15--- The compiler's five panic atoms. A program may supply the specified
16--- nonreturning panic handler; these failures are not allocator error
17--- returns.
18public panic_kind: type = out_of_range | overflow | bad_conversion | unreachable | stack_exhausted
19
20--- Where a call was written: the struct [1040] gives a `caller` parameter,
21--- whose fields the compiler fills, line and column counting from one. Its
22--- file is a number that the table written beside the program names. This
23--- is not the number a panic handler receives as its `site` [1670].
24public call_site: type = struct
25 file_id: u32
26 line: u32
27 column: u32
28end call_site
29
30--- Stop the program, as a failed check does, when `holds` is false: C's
31--- `assert`, with nothing that turns it off. The stop is reported where
32--- `require` was called, the call site the compiler fills `where` with
33--- (D1959); a routine that checks for its own caller takes a `caller`
34--- parameter too and passes it on, `panic.require(holds, where: where)`.
35public require: (holds: bool, caller where: call_site) -> none =
36 if not holds then compiler.unreachable(where) end if
37end require