cancel, defer, errdefer all working as intended now

This commit is contained in:
Andrew Kelley
2019-08-08 11:37:49 -04:00
parent e11cafbd4f
commit 34bfdf193a
7 changed files with 246 additions and 65 deletions

View File

@@ -1550,6 +1550,11 @@ static void ir_print_await_gen(IrPrint *irp, IrInstructionAwaitGen *instruction)
fprintf(irp->f, ")");
}
static void ir_print_test_cancel_requested(IrPrint *irp, IrInstructionTestCancelRequested *instruction) {
const char *arg = instruction->use_return_begin_prev_value ? "UseReturnBeginPrevValue" : "AdditionalCheck";
fprintf(irp->f, "@testCancelRequested(%s)", arg);
}
static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
ir_print_prefix(irp, instruction);
switch (instruction->id) {
@@ -2032,6 +2037,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) {
case IrInstructionIdAwaitGen:
ir_print_await_gen(irp, (IrInstructionAwaitGen *)instruction);
break;
case IrInstructionIdTestCancelRequested:
ir_print_test_cancel_requested(irp, (IrInstructionTestCancelRequested *)instruction);
break;
}
fprintf(irp->f, "\n");
}