authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 13:16:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-07 13:17:23-07:00
log015599d1ef1606e56c49118800a4c7ef36c038e6
tree345ea153b49edb87320966c5b9d8a9732993b472
parent090834380cff9f2743f9c71e8e141ac5aceb747e

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

1 files changed, 19 insertions(+), 4 deletions(-)

src/codegen/c.zig+19-4
......@@ -396,6 +396,9 @@ pub const DeclGen = struct {
396396 else => unreachable,
397397 }
398398 },
399
400 .Float => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Float", .{}),
401
399402 .Pointer => {
400403 if (t.isSlice()) {
401404 return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement slices", .{});
......@@ -507,10 +510,22 @@ pub const DeclGen = struct {
507510
508511 try dg.renderType(w, int_tag_ty);
509512 },
510 .Null, .Undefined => unreachable, // must be const or comptime
511 else => |e| return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type {s}", .{
512 @tagName(e),
513 }),
513 .Union => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Union", .{}),
514 .Fn => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Fn", .{}),
515 .Opaque => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Opaque", .{}),
516 .Frame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Frame", .{}),
517 .AnyFrame => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type AnyFrame", .{}),
518 .Vector => return dg.fail(.{ .node_offset = 0 }, "TODO: C backend: implement type Vector", .{}),
519
520 .Null,
521 .Undefined,
522 .EnumLiteral,
523 .ComptimeFloat,
524 .ComptimeInt,
525 .Type,
526 => unreachable, // must be const or comptime
527
528 .BoundFn => unreachable, // this type will be deleted from the language
514529 }
515530 }
516531