summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
authorKai Gunger <kgunger12@gmail.com>2026-04-30 02:02:02 -0400
committerKai Gunger <kgunger12@gmail.com>2026-04-30 02:02:02 -0400
commitedba04ae6266536cf7285570eb31245298a5123f (patch)
treeea6dd2e14413ef90a78000ca9aa43094af07f7ea /tnslc
parent31b1dc66982320aa3f4279bd066129e2a110e543 (diff)
[tnslc] small fix for finding module vars
Diffstat (limited to 'tnslc')
-rw-r--r--tnslc/compile/function.tnsl5
-rw-r--r--tnslc/compile/var.tnsl5
2 files changed, 8 insertions, 2 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
index 0a22f8d..bde7d2c 100644
--- a/tnslc/compile/function.tnsl
+++ b/tnslc/compile/function.tnsl
@@ -544,7 +544,8 @@ struct Function {
# If could not find in scope then try to find in module
~uint8 name = base`.data
v`.push(~name)
- vv = s`.mod`.find(SEARCH_VAR, v)
+ ~Module mod = s`.mod
+ vv = mod`.find(SEARCH_VAR, v)
/; if (vv !== NULL)
result = vv`.as_global()
v`.end()
@@ -623,7 +624,7 @@ struct Function {
;/
self._compile_chain_r_post(s, post, ~result)
;/
-
+
return result
;/
diff --git a/tnslc/compile/var.tnsl b/tnslc/compile/var.tnsl
index e5e6bae..cc5b409 100644
--- a/tnslc/compile/var.tnsl
+++ b/tnslc/compile/var.tnsl
@@ -837,6 +837,11 @@ struct Var {
/; as_global [Var]
Var out = self.copy()
out.name = self._global_base()
+
+ int loc = 0
+ loc = loc - 2
+ out.loc = loc
+
return out
;/