From ca5b305ab25c42fba3d022fd0e4c4288159c451b Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Mon, 15 May 2023 00:36:45 -0400 Subject: Fixed struct returns (struct calls still do not work) --- tnslc/simple.tnsl | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'tnslc/simple.tnsl') diff --git a/tnslc/simple.tnsl b/tnslc/simple.tnsl index ea517d4..5ef7946 100644 --- a/tnslc/simple.tnsl +++ b/tnslc/simple.tnsl @@ -1,15 +1,34 @@ {}uint8 str1 = "abcd" +struct Stress { + int i +} + +struct Test { + Stress s +} + +/; s_call () [Stress] + Stress a + a.i = 1 + return a +;/ + /; main (int argc, ~~uint argv) [int] # On windows, the first two arguments are passed in RCX and RDX, so we need to # update their positions here or else tnsl will have garbage values in r8 and r9 asm "mov r8, rcx" asm "mov r9, rdx" - ~uint8 a = ~str1{0} + Stress test + Test stress + + test.i = 1 + + stress.s = s_call() # return 3 - return a` + return stress.s.i ;/ -- cgit v1.2.3