diff --git a/meta/module.jai b/meta/module.jai index 0a30651..88174ab 100644 --- a/meta/module.jai +++ b/meta/module.jai @@ -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); } }