add raw pointers

This commit is contained in:
nora 2023-08-05 14:20:24 +02:00
parent 5bac67b84c
commit 64d81b5608
8 changed files with 101 additions and 29 deletions

13
ui-tests/raw_ptr.nil Normal file
View file

@ -0,0 +1,13 @@
//@check-pass
type A = struct { a: Int };
function main() = (
let a = A { a: 0 };
rawr(___transmute(a));
std.printInt(a.a);
);
function rawr(a: *A) = (
a.a = 1;
);

View file

@ -0,0 +1,21 @@
//@check-pass
type A = struct { a: Int };
type Complex = struct {
a: Int,
b: (Int, A),
};
function main() = (
let a = A { a: 0 };
// let b = 0;
// let c = Complex { a: 0, b: (0, a) };
write(a);
// c.b.1.a = 1; TODO
);
function write(a: A) = a.a = 1;
function ret(): A = A { a: 0 };