lang: ast: fix selector, unit-package, and unit-import string conversion

stringifying selectors with unnamed args no longer causes a segfault,
and unit-package and unit-import node strings are now formatted correctly.
This commit is contained in:
2025-04-23 10:58:22 +01:00
parent c7aa3b422d
commit 3af786b32c
3 changed files with 12 additions and 3 deletions

View File

@@ -269,7 +269,7 @@ static void to_string(struct ivy_ast_node *node, b_string *str)
label = b_unbox(struct ivy_token, label_it.entry, t_entry);
name = b_unbox(struct ivy_token, name_it.entry, t_entry);
if (label && label->t_type == IVY_TOK_LABEL) {
if (label && label->t_type == IVY_TOK_LABEL && label->t_str) {
b_string_append_cstrf(str, "%s:", label->t_str);
} else {
b_string_append_cstrf(str, "_:");