From 6c8b919d17fd456671710087c199bfd7d5a13c38 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sat, 19 Nov 2016 01:56:48 -0500 Subject: [PATCH] IR: implement ir_print for maybe type --- src/ir_print.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ir_print.cpp b/src/ir_print.cpp index 1bf7776371..7ae1794a28 100644 --- a/src/ir_print.cpp +++ b/src/ir_print.cpp @@ -105,11 +105,19 @@ static void ir_print_const_value(IrPrint *irp, TypeTableEntry *type_entry, Const fprintf(irp->f, "null"); break; } + case TypeTableEntryIdMaybe: + { + if (const_val->data.x_maybe) { + ir_print_const_value(irp, type_entry->data.maybe.child_type, const_val->data.x_maybe); + } else { + fprintf(irp->f, "null"); + } + break; + } case TypeTableEntryIdVar: case TypeTableEntryIdFloat: case TypeTableEntryIdStruct: case TypeTableEntryIdUndefLit: - case TypeTableEntryIdMaybe: case TypeTableEntryIdErrorUnion: case TypeTableEntryIdPureError: case TypeTableEntryIdEnum: