diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-11-18 23:52:42 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-11-18 23:52:42 -0500 |
| commit | 19037014e5a25eaac9564d22cc04cf12fb6ef98e (patch) | |
| tree | ec7ec61515ddf48ab94585d054bb69c329febce3 /src/codegen.cpp | |
| parent | 31565efe9d6cde2e4909f986d50f8c46166d3311 (diff) | |
| download | zig-19037014e5a25eaac9564d22cc04cf12fb6ef98e.tar.gz zig-19037014e5a25eaac9564d22cc04cf12fb6ef98e.zip | |
IR: more maybe type support
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 7e80ee2073..278e983e93 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -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: |
