From 68db9d5074cece234efa3a5352fe6cd36d210455 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Tue, 4 Sep 2018 15:28:13 -0400 Subject: add compile error for comptime control flow inside runtime block closes #834 --- src/ir_print.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ir_print.cpp') diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 77c7ef47b6..d57d554c72 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -957,6 +957,14 @@ static void ir_print_enum_to_int(IrPrint *irp, IrInstructionEnumToInt *instructi fprintf(irp->f, ")"); } +static void ir_print_check_runtime_scope(IrPrint *irp, IrInstructionCheckRuntimeScope *instruction) { + fprintf(irp->f, "@checkRuntimeScope("); + ir_print_other_instruction(irp, instruction->scope_is_comptime); + fprintf(irp->f, ","); + ir_print_other_instruction(irp, instruction->is_comptime); + fprintf(irp->f, ")"); +} + static void ir_print_int_to_err(IrPrint *irp, IrInstructionIntToErr *instruction) { fprintf(irp->f, "inttoerr "); ir_print_other_instruction(irp, instruction->target); @@ -1749,6 +1757,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdEnumToInt: ir_print_enum_to_int(irp, (IrInstructionEnumToInt *)instruction); break; + case IrInstructionIdCheckRuntimeScope: + ir_print_check_runtime_scope(irp, (IrInstructionCheckRuntimeScope *)instruction); + break; } fprintf(irp->f, "\n"); } -- cgit v1.2.3