diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 19:40:26 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-12-18 19:40:26 -0500 |
| commit | a71fbe49cbbf068e00300533d5f3874efadb8c18 (patch) | |
| tree | 57c6c4150b910efce96251b14003d46f00cf6afa /src/ir_print.cpp | |
| parent | f12fbce0f51d58b429afd8a359aeb8a3b27a4eb0 (diff) | |
| download | zig-a71fbe49cbbf068e00300533d5f3874efadb8c18.tar.gz zig-a71fbe49cbbf068e00300533d5f3874efadb8c18.zip | |
IR: add FnProto instruction
Diffstat (limited to 'src/ir_print.cpp')
| -rw-r--r-- | src/ir_print.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 298f72a202..1251a23c86 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -882,6 +882,17 @@ static void ir_print_err_wrap_payload(IrPrint *irp, IrInstructionErrWrapPayload fprintf(irp->f, ")"); } +static void ir_print_fn_proto(IrPrint *irp, IrInstructionFnProto *instruction) { + fprintf(irp->f, "fn("); + for (size_t i = 0; i < instruction->base.source_node->data.fn_proto.params.length; i += 1) { + if (i != 0) + fprintf(irp->f, ","); + ir_print_other_instruction(irp, instruction->param_types[i]); + } + fprintf(irp->f, ")->"); + ir_print_other_instruction(irp, instruction->return_type); +} + static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { ir_print_prefix(irp, instruction); switch (instruction->id) { @@ -1112,6 +1123,9 @@ static void ir_print_instruction(IrPrint *irp, IrInstruction *instruction) { case IrInstructionIdErrWrapPayload: ir_print_err_wrap_payload(irp, (IrInstructionErrWrapPayload *)instruction); break; + case IrInstructionIdFnProto: + ir_print_fn_proto(irp, (IrInstructionFnProto *)instruction); + break; } fprintf(irp->f, "\n"); } |
