summaryrefslogtreecommitdiff
path: root/tnslc
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-10-05 03:50:37 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-10-05 03:50:37 -0400
commit7824a4709a306d48893f88ec586b6f50bfdde875 (patch)
tree03d52a02c9403712fba4172ceae5cfc67640cf79 /tnslc
parent73487b32f319f0898b836ebfc0962c122d4fcb5c (diff)
[tnslc] fix mem leak
Diffstat (limited to 'tnslc')
-rw-r--r--tnslc/parse/ast.tnsl13
1 files changed, 9 insertions, 4 deletions
diff --git a/tnslc/parse/ast.tnsl b/tnslc/parse/ast.tnsl
index 6944e1e..d70d755 100644
--- a/tnslc/parse/ast.tnsl
+++ b/tnslc/parse/ast.tnsl
@@ -1013,12 +1013,16 @@ struct Node {
;; else if (_advance_check(fin, first, "loop\0") == true)
block_type = NTYPE_LOOP_BLOCK
;; else
- first` = produce_next_token(fin, first`)
+ Token tok = produce_next_token(fin, first`)
+ first`.end()
+ first` = tok
;/
Node out
out.init(block_type, utils.strcpy("\0"))
- first` = produce_next_token(fin, first`)
+ Token tok = produce_next_token(fin, first`)
+ first`.end()
+ first` = tok
/; if (block_type != NTYPE_ELSE_BLOCK && first`.eq("(\0") == true)
_ast_list_stmt(fin, ~out, first)
@@ -1331,16 +1335,17 @@ struct Node {
return at
;/
-/; _mhf_escape (~utils.File, ~Node mod, ~Token first, ~Node cur)
+/; _mhf_escape (~utils.File fin, ~Node mod, ~Token first, ~Node cur)
;/
/; _mhf_finish_value (~utils.File fin, ~Node mod, ~Token first, ~Node cur)
+ return
# Q1: What are all the possible states we could have been called from
# A: Inside a tlist when we discovered an invalid token for a type
# After an identifier when we discovered an invalid type
# After a valid type where we saw a non-identifier
- # After a line break, likely meaning we already saw
+ # After a line break, likely meaning the whole thing was likely already transformed
/; loop (bool run = true; run == true && first`._type !== TTYPE_ERR)
;/
;/