From 5749be69125dc87ac50742295272a7e21f4f472e Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Sat, 31 May 2025 22:54:26 +0200 Subject: codegen integer literals correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was not as easy as one would expect ☠️ --- src/compile.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/compile.zig') diff --git a/src/compile.zig b/src/compile.zig index ad5fc59..c723842 100644 --- a/src/compile.zig +++ b/src/compile.zig @@ -102,7 +102,7 @@ const CompileContext = struct { switch (expr.type) { .integer_literal => try addInstr(self, .{ .loc = expr.loc, - .type = .{ .constant = .{ .dest = dest, .value = expr.getInt(self.source) } }, + .type = .{ .constant = .{ .dest = dest, .value = expr.loc.getInt(self.source) } }, }), .bin_op => |binop| { const lhs = try self.compileExpr(binop.lhs); -- cgit v1.2.3