summaryrefslogtreecommitdiff
path: root/tnslc/tnslc.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2023-03-23 01:30:03 -0400
committerKyle Gunger <kgunger12@gmail.com>2023-03-23 01:30:03 -0400
commita81122df8f081fc6f7cbe338f094bd8da9ba0486 (patch)
tree950b7d44618d7c8f40c23f210502badf90844d6a /tnslc/tnslc.tnsl
parent9066d5215225a32865cb628dad1c69997efffe62 (diff)
Make `self` a valid name in method blocks
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r--tnslc/tnslc.tnsl11
1 files changed, 11 insertions, 0 deletions
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl
index 1054d7b..ecc9e61 100644
--- a/tnslc/tnslc.tnsl
+++ b/tnslc/tnslc.tnsl
@@ -1633,6 +1633,7 @@
/; parse_param_list (~{}Token tok, ~int cur, ~Module current) [{}Variable]
;{}Variable out = {}
+
;int max = find_closing(tok, cur)
;Type t = NO_TYPE
/; loop (cur` = next_non_nl(tok, cur` + 1); cur` < max) [cur` = next_non_nl(tok, cur` + 1)]
@@ -2554,6 +2555,16 @@
;int max = find_closing(tok, cur)
;bool m = false, returned = false
;Type ret = NO_TYPE
+
+ /; if (len (current`.name) > 2)
+ /; if (current`.name{0} == '_' && current`.name{1} == '#')
+ ;{}{}uint8 split = string_split(current`.name, '#')
+ ;Type st = current`.find_type( {split{1}} )`
+ ;st.ptr_chain = {PTYPE.REFERENCE}
+ ;root.vars.append({"self", st, 0, 0})
+ ;/
+ ;/
+
/; loop (cur`++; cur` < max && !m) [cur`++]
/; if (tok`{cur`}.type_is(TOKEN.DEFWORD))
;root.name = tok`{cur`}.data