about summary refs log tree commit diff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorBaitinq <[email protected]>2025-03-24 23:33:26 +0100
committerBaitinq <[email protected]>2025-03-24 23:33:26 +0100
commit2d8538557dfdd8b86879e4a7ae35749f659bcb34 (patch)
tree71bbed42f1366fed99fe1a3c12efb867320231e5 /src/codegen.zig
parentExamples: Add example of interacting with 3rd party library (diff)
downloadpry-lang-2d8538557dfdd8b86879e4a7ae35749f659bcb34.tar.gz
pry-lang-2d8538557dfdd8b86879e4a7ae35749f659bcb34.tar.bz2
pry-lang-2d8538557dfdd8b86879e4a7ae35749f659bcb34.zip
Feature: Add "proper" pointer types
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index 552dd4b..fc956a5 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -518,7 +518,6 @@ pub const CodeGen = struct {
             .SIMPLE_TYPE => |t| {
                 if (std.mem.eql(u8, t.name, "i64")) return llvm.LLVMInt64Type();
                 if (std.mem.eql(u8, t.name, "bool")) return llvm.LLVMInt1Type();
-                if (std.mem.eql(u8, t.name, "ptr")) return llvm.LLVMPointerType(llvm.LLVMInt8Type(), 0); //TODO: id like *i64
                 unreachable;
             },
             // TODO: Properly handle this vv
@@ -531,6 +530,10 @@ pub const CodeGen = struct {
                 const function_type = llvm.LLVMFunctionType(return_type, paramtypes.items.ptr, @intCast(paramtypes.items.len), 0) orelse unreachable;
                 return function_type;
             },
+            .POINTER_TYPE => |t| {
+                const inner_type = try self.get_llvm_type(t.type);
+                return llvm.LLVMPointerType(inner_type, 0);
+            },
         }
     }