remove duplication
This commit is contained in:
parent
e52a9b0275
commit
0e32e7f153
1 changed files with 3 additions and 2 deletions
|
|
@ -20,14 +20,15 @@ get_stack_trace_caller_location :: (loc := #caller_location) -> Source_Code_Loca
|
|||
}
|
||||
|
||||
check_bounds :: ($$index: $T, $$count: T, loc := #caller_location) #expand {
|
||||
MESSAGE :: "bounds check failed! index % (max %)";
|
||||
#if is_constant(index) && is_constant(count) {
|
||||
if index < 0 || index >= count {
|
||||
message := basic.tprint("bounds check failed! index was % (max %)", index, count - 1);
|
||||
message := basic.tprint(MESSAGE, index, count - 1);
|
||||
compiler.compiler_report(message, mode = .ERROR, loc = loc);
|
||||
}
|
||||
}
|
||||
else {
|
||||
basic.assert(index >= 0 && index < count, "bounds check failed! index was % (max %)", index, count -1, loc = loc);
|
||||
basic.assert(index >= 0 && index < count, MESSAGE, index, count -1, loc = loc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue