about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-03-08 18:50:50 +0100
committerBaitinq <[email protected]>2025-03-08 18:50:50 +0100
commitee724245d24bd018451b268cce2f162b8064657d (patch)
tree3a3380ca67ec7233d6897c05c92f56edfc58ef52
parentMisc: Remove comments (diff)
downloadpry-lang-ee724245d24bd018451b268cce2f162b8064657d.tar.gz
pry-lang-ee724245d24bd018451b268cce2f162b8064657d.tar.bz2
pry-lang-ee724245d24bd018451b268cce2f162b8064657d.zip
Codegen: Use alternative way of knowing if we should load function before call
-rw-r--r--src/codegen.zig4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 9256776..c780713 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -158,9 +158,7 @@ pub const CodeGen = struct {
             .PRIMARY_EXPRESSION => |primary_expression| {
                 std.debug.assert(primary_expression == .IDENTIFIER);
                 function = self.environment.get_variable(primary_expression.IDENTIFIER.name) orelse return CodeGenError.CompilationError;
-                std.debug.print("STACK LVEL: {any} {s}\n", .{ function.stack_level.?, primary_expression.IDENTIFIER.name });
-                if (function.stack_level.? > 0) {
-                    std.debug.print("NOT GLOBAL FN! {s} {any}\n", .{ primary_expression.IDENTIFIER.name, function.stack_level });
+                if (core.LLVMGetValueKind(function.value) != types.LLVMValueKind.LLVMFunctionValueKind) {
                     function.value = core.LLVMBuildLoad2(self.builder, core.LLVMPointerType(function.type, 0), function.value, "");
                 }
             },