diff options
| author | Ginger Bill <bill@gingerbill.org> | 2016-09-12 15:10:15 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2016-09-12 15:10:15 +0100 |
| commit | d4ba6b546632b3174533a2d099031362f74085e9 (patch) | |
| tree | 3d8e1db3d89993e0a2db5af05c49a27fbb053c6e /code | |
| parent | 9ff4a8b5ab1edaa333180b8206a734787cdfb9f1 (diff) | |
Slice and substring bounds checking
Diffstat (limited to 'code')
| -rw-r--r-- | code/runtime.odin | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/code/runtime.odin b/code/runtime.odin index 322440c5b..aedcdc9ba 100644 --- a/code/runtime.odin +++ b/code/runtime.odin @@ -291,7 +291,20 @@ __assert :: proc(msg: string) { } __abc_error :: proc(file: string, line, column: int, index, len: int) { - print(file, "(", line, ":", line, ") Index out of bounds: index: ", index, ", len: ", len, "\n") + print(file, "(", line, ":", line, ") Index `", index, "` is of bounds range [0, ", len, ")\n") __debug_trap() } +__slice_expr_error :: proc(file: string, line, column: int, low, high, max: int) { + print(file, "(", line, ":", line, ") Invalid slice indices: [", low, ":", high, ":", max, "]\n") + __debug_trap() +} +__substring_expr_error :: proc(file: string, line, column: int, low, high: int) { + print(file, "(", line, ":", line, ") Invalid substring indices: [", low, ":", high, "]\n") + __debug_trap() +} + + + + + |