aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-09-04 15:28:13 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-09-04 15:28:35 -0400
commit68db9d5074cece234efa3a5352fe6cd36d210455 (patch)
treeb79ead870777d9d90ab809b70a687c77af20df0d /src/ir_print.cpp
parent36828a2e6aa6879641bf6980379dd806b6f479a1 (diff)
downloadzig-68db9d5074cece234efa3a5352fe6cd36d210455.tar.gz
zig-68db9d5074cece234efa3a5352fe6cd36d210455.zip
add compile error for comptime control flow inside runtime block
closes #834
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp11
1 files changed, 11 insertions, 0 deletions
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");
}