IR: more maybe type support

This commit is contained in:
Andrew Kelley
2016-11-18 23:52:42 -05:00
parent 31565efe9d
commit 19037014e5
4 changed files with 150 additions and 86 deletions

View File

@@ -3242,9 +3242,19 @@ static void get_c_type(CodeGen *g, TypeTableEntry *type_entry, Buf *out_buf) {
buf_appendf(out_buf, "%s%s *", const_str, buf_ptr(&child_buf));
break;
}
case TypeTableEntryIdMaybe:
{
TypeTableEntry *child_type = type_entry->data.maybe.child_type;
if (child_type->id == TypeTableEntryIdPointer ||
child_type->id == TypeTableEntryIdFn)
{
return get_c_type(g, child_type, out_buf);
} else {
zig_unreachable();
}
}
case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
case TypeTableEntryIdMaybe:
case TypeTableEntryIdErrorUnion:
case TypeTableEntryIdPureError:
case TypeTableEntryIdEnum: