summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-05-14 12:10:27 -0400
committerKyle Gunger <kgunger12@gmail.com>2023-05-14 12:10:27 -0400
commit52ec72efcd748473c15fad74ff03cd9d88c38ccd (patch)
treea16d9a982d88c29cf79998eeccbd5516c0264ae7 /tnslc
parent89f2b3b4a40749eba388ea998b99381a37bbeb53 (diff)
Fix an issue with tmp vars of ref type
Diffstat (limited to 'tnslc')
-rw-r--r--tnslc/simple.tnsl4
-rw-r--r--tnslc/tnslc.tnsl10
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)