ludic.ui: parsing at load gives back what it does not keep - tpl_words written once into bytes of its own (a string a character before), a stylesheet's stripped text, its error list and each reader freed once read, ex_text's joining node freed when it collapses to one piece or none

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 20:06:25 +03:00
parent d9612ba2a6
commit 179dd60536
3 changed files with 31 additions and 9 deletions

View file

@ -82,7 +82,14 @@ function ex_text(src: string, err: []string) -> UiExpr {
i += 1
}
if at < len(src) { push(e.args, ex_lit(Value.str(src[at..len(src)]))) }
if len(e.args) == 0 { return ex_lit(Value.str("")) }
if len(e.args) == 1 { return e.args[0] }
return e
if len(e.args) > 1 { return e }
# one piece or none: the joining node is not kept, so it is given back
var one: UiExpr = null
if len(e.args) == 1 { one = e.args[0] }
unsafe {
free(e.args)
free(e)
}
if one == null { return ex_lit(Value.str("")) }
return one
}