lots of miscellaneous things all in one big commit
* add `@compileLog(...)` builtin function - Helps debug code running at compile time - See #240 * fix crash when there is an error on the start value of a slice * add implicit cast from int and float types to int and float literals if the value is known at compile time * make array concatenation work with slices in addition to arrays and c string literals * fix compile error message for something not having field access * fix crash when `@setDebugSafety()` was called from a function being evaluated at compile-time * fix compile-time evaluation of overflow math builtins. * avoid debug safety panic handler in builtin.o and compiler_rt.o since we use no debug safety in these modules anyway * add compiler_rt functions for division on ARM - Closes #254 * move default panic handler to std.debug so users can call it manually * std.io.printf supports a width in the format specifier
This commit is contained in:
@@ -532,6 +532,17 @@ static void ir_print_compile_err(IrPrint *irp, IrInstructionCompileErr *instruct
|
||||
fprintf(irp->f, ")");
|
||||
}
|
||||
|
||||
static void ir_print_compile_log(IrPrint *irp, IrInstructionCompileLog *instruction) {
|
||||
fprintf(irp->f, "@compileLog(");
|
||||
for (size_t i = 0; i < instruction->msg_count; i += 1) {
|
||||
if (i != 0)
|
||||
fprintf(irp->f, ",");
|
||||
IrInstruction *msg = instruction->msg_list[i];
|
||||
ir_print_other_instruction(irp, msg);
|
||||
}
|
||||
fprintf(irp->f, ")");
|
||||
}
|
||||
|
||||
static void ir_print_err_name(IrPrint *irp, IrInstructionErrName *instruction) {
|
||||
fprintf(irp->f, "@errorName(");
|
||||
ir_print_other_instruction(irp, instruction->value);
|
||||
@@ -990,6 +1001,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
|
||||
case IrInstructionIdCompileErr:
|
||||
ir_print_compile_err(irp, (IrInstructionCompileErr *)instruction);
|
||||
break;
|
||||
case IrInstructionIdCompileLog:
|
||||
ir_print_compile_log(irp, (IrInstructionCompileLog *)instruction);
|
||||
break;
|
||||
case IrInstructionIdErrName:
|
||||
ir_print_err_name(irp, (IrInstructionErrName *)instruction);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user