zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 015599d1ef1606e56c49118800a4c7ef36c038e6 (tree)
parent 090834380cff9f2743f9c71e8e141ac5aceb747e
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed,  7 Apr 2021 13:16:36 -0700

C backend: enumerate all the types in renderType

Now that we're close to supporting all the types, get rid of the `else`
prong and explicitly list out those types that are not yet implemented.

Thanks @g-w1

Diffstat:
Msrc/codegen/c.zig | 23+++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/codegen/c.zig b/src/codegen/c.zig @@ -396,6 +396,9 @@ pub const DeclGen = struct { else => unreachable, } }, + + .Float => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Float", .{}), + .Pointer => { if (t.isSlice()) { return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement slices", .{}); @@ -507,10 +510,22 @@ pub const DeclGen = struct { try dg.renderType(w, int_tag_ty); }, - .Null, .Undefined => unreachable, // must be const or comptime - else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{ - @tagName(e), - }), + .Union => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Union", .{}), + .Fn => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Fn", .{}), + .Opaque => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Opaque", .{}), + .Frame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Frame", .{}), + .AnyFrame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type AnyFrame", .{}), + .Vector => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Vector", .{}), + + .Null, + .Undefined, + .EnumLiteral, + .ComptimeFloat, + .ComptimeInt, + .Type, + => unreachable, // must be const or comptime + + .BoundFn => unreachable, // this type will be deleted from the language } }