Skip to content

Commit

Permalink
fix: Avoid crash when generating invalid add binary
Browse files Browse the repository at this point in the history
  • Loading branch information
giann committed May 31, 2024
1 parent 7563722 commit b2b18a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Codegen.zig
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,11 @@ fn generateBinary(self: *Self, node: Ast.Node.Index, breaks: ?*Breaks) Error!?*o
.Map => .OP_ADD_MAP,
.Integer => .OP_ADD_I,
.Float => .OP_ADD_F,
else => unreachable,
else => other: {
std.debug.assert(self.reporter.had_error);

break :other .OP_ADD_I;
},
});
},
.Minus => {
Expand Down

0 comments on commit b2b18a7

Please sign in to comment.