From a81122df8f081fc6f7cbe338f094bd8da9ba0486 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Thu, 23 Mar 2023 01:30:03 -0400 Subject: Make `self` a valid name in method blocks --- tnslc/tnslc.tnsl | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tnslc/tnslc.tnsl') 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 -- cgit v1.2.3