diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2023-05-14 10:35:43 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2023-05-14 10:35:43 -0400 |
commit | 3217d450a61d5acb5f268604ce97b7b134697afd (patch) | |
tree | 011b8e7f1976d28c8933f8e05ac333a544c9afb5 /tnslc/tnslc.tnsl | |
parent | 6a64c6f33f345b88bf6f7fcbe18f7757706a9976 (diff) |
Fix postfix operator
Diffstat (limited to 'tnslc/tnslc.tnsl')
-rw-r--r-- | tnslc/tnslc.tnsl | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tnslc/tnslc.tnsl b/tnslc/tnslc.tnsl index 5248a29..485113d 100644 --- a/tnslc/tnslc.tnsl +++ b/tnslc/tnslc.tnsl @@ -3063,12 +3063,12 @@ ;/ ;Variable s1, s2 + ;layer` = layer` + 1 /; if (first == start) ;s1 = _eval_value(tok, first + 1, max, out, mov, current, scope, t, layer) ;; else if (first == max - 1) ;s1 = _eval_value(tok, start, first, out, mov, current, scope, t, layer) ;; else - ;layer` = layer` + 1 /; if (tok`{first}.cmp("=")) ;layer` = layer` - 1 ;/ @@ -3076,7 +3076,7 @@ ;s1 = _eval_value(tok, start, first, out, mov, current, scope, t, layer) ;t = s1.data_type - ;t.strip_refs() + ;t.strip_refs() ;s2 = _eval_value(tok, first + 1, max, out, mov, current, scope, t, ~l2) /; if (tok`{first}.cmp("=")) @@ -3084,13 +3084,13 @@ ;/ ;log_debug(string_add("Calculated s2 as ", s2.sprint())) - ;layer` = layer` - 1 ;/ - + ;layer` = layer` - 1 + ;log_debug(string_add("Calculated s1 as ", s1.sprint())) /; if (tok`{first}.cmp("=")) - ;s1.set(s2, out) + ;s1.set(s2, out) ;return s1 ;/ @@ -3106,13 +3106,21 @@ }, " ")) # Inc and dec - /; else if (tok`{first}.cmp("++") || tok`{first}.cmp("--")) + /; if (tok`{first}.cmp("++") || tok`{first}.cmp("--")) + ;wk.data_type = s1.data_type + ;wk.data_type.strip_refs() + ;wk.set(s1, out) + /; if (tok`{first}.cmp("++")) ;s1.inc(out) ;; else ;s1.dec(out) ;/ + /; if (first == max - 1) + ;return wk + ;/ + ;return s1 ;/ |