summaryrefslogtreecommitdiff
path: root/tnslc/compile/function.tnsl
diff options
context:
space:
mode:
Diffstat (limited to 'tnslc/compile/function.tnsl')
-rw-r--r--tnslc/compile/function.tnsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/tnslc/compile/function.tnsl b/tnslc/compile/function.tnsl
index bde7d2c..f945479 100644
--- a/tnslc/compile/function.tnsl
+++ b/tnslc/compile/function.tnsl
@@ -25,6 +25,29 @@ struct Function {
~parse.Node n
int reg = 1
int stack_up = 8
+
+ /; if (self.m == true)
+ ~Struct s = parent`.related_type()
+ Var p
+ p._init(s)
+ _delete(p.name)
+ p.name = utils.strcpy("self\0")
+ p.ptr_push(0)
+ p.loc = reg
+ reg++
+ self.inputs.push(~p)
+ _printf("Generated self:\n\0")
+ p._print(0)
+ ;; else
+ _printf("Did not generate self for \"\0")
+ _printf(self.name)
+ _printf("\"\n\0")
+ ;/
+
+ /; if (dl == NULL)
+ return
+ ;/
+
/; loop (int i = 0; i < dl`.sub.count) [i++]
n = dl`.sub.get(i)
/; if (n`._type == parse.NTYPE_TYPE)
@@ -86,6 +109,9 @@ struct Function {
/; _resolve_type (~Module parent)
~parse.Node _up = self._up
/; if (_up`.sub.count < 1)
+ /; if (self.m == true)
+ self._resolve_dlist(parent, NULL)
+ ;/
return
;/
@@ -95,6 +121,8 @@ struct Function {
/; if (_up`.sub.count > 1)
lst = _up`.sub.get(1)
;/
+ ;; else if (self.m == true)
+ self._resolve_dlist(parent, NULL)
;/
/; if (lst`._type == parse.NTYPE_TLIST)
@@ -192,6 +220,12 @@ struct Function {
~Var in
/; loop (int i = 0; i < self.inputs.count) [i++]
in = self.inputs.get(i)
+ /; if (in.is_ref())
+ ~int32 ptc = in.top_ptrc()
+ int32 set = 0
+ set = set - 1
+ ptc` = set
+ ;/
out.mk_set_var(in)
;/