commit 1b9f1f054fb615d258beaaf0d971380e1d29b0c3
parent 31ddfc81840d33a9fae220c89a368e3a4fe5ff17
Author: Thomas Vigouroux <thomas.vigouroux@univ-grenoble-alpes.fr>
Date: Fri, 14 Jun 2024 13:42:15 +0200
fix(tco): do not generate return
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/compile.zig b/src/compile.zig
@@ -173,6 +173,7 @@ pub const Compiler = struct {
}
try self.getChunk().write(.{ .popscope = .{ .offset = self.func.arity, .scope = self.func.arity } });
try self.getChunk().write(.{ .jump = 0 });
+ state.return_this = false;
} else {
const symc = try self.getChunk().addConstant(lst[0].ref());
try self.getChunk().write(.{ .get_global = symc });
@@ -189,6 +190,7 @@ pub const Compiler = struct {
}
if (state.return_this) {
+ complog.debug("Generate return for {}, offset={}", .{val.formatter(), self.getChunk().nextPc()});
try self.getChunk().write(.@"return");
}
}