From 52ec72efcd748473c15fad74ff03cd9d88c38ccd Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Sun, 14 May 2023 12:10:27 -0400 Subject: Fix an issue with tmp vars of ref type --- tnslc/simple.tnsl | 4 +++- tnslc/tnslc.tnsl | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tnslc/simple.tnsl b/tnslc/simple.tnsl index 29113b7..ea517d4 100644 --- a/tnslc/simple.tnsl +++ b/tnslc/simple.tnsl @@ -7,7 +7,9 @@ asm "mov r8, rcx" asm "mov r9, rdx" + ~uint8 a = ~str1{0} + # return 3 - return argc + len str1 + return a` ;/ diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl index 2695706..b80a2ab 100644 --- a/tnslc/tnslc.tnsl +++ b/tnslc/tnslc.tnsl @@ -2932,8 +2932,16 @@ /; if (layer` > 1) ;log_debug("Dot tmp variable generated") - ;Variable tt = scope`.new_tmp_var(wk.data_type, out) + ;Variable tt + + /; if (wk.is_ref()) + ;tt = scope`.new_tmp_var({8, "void", {PTYPE.POINTER}, {}, 0}, out) + ;; else + ;tt = scope`.new_tmp_var(wk.data_type, out) + ;/ + ;tt.set_raw(wk, out) + ;tt.data_type = wk.data_type ;wk = tt ;; else if (layer` == 1) ;wk.move_register(2, out) -- cgit v1.2.3