diff --git a/lang/ast/selector.c b/lang/ast/selector.c index 9a8dace..339fd59 100644 --- a/lang/ast/selector.c +++ b/lang/ast/selector.c @@ -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, "_:"); diff --git a/lang/ast/unit-import.c b/lang/ast/unit-import.c index 5eab680..c2f8071 100644 --- a/lang/ast/unit-import.c +++ b/lang/ast/unit-import.c @@ -64,16 +64,21 @@ static void to_string(struct ivy_ast_node *node, b_string *str) b_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type)); + b_string_append_cstr(str, " ("); + + int i = 0; + b_queue_iterator it = {0}; b_queue_foreach (&it, &unit_import->n_ident) { struct ivy_token *tok = b_unbox(struct ivy_token, it.entry, t_entry); - if (b_string_get_size(str, B_STRLEN_NORMAL) > 0) { + if (i > 0) { b_string_append_cstr(str, "."); } b_string_append_cstr(str, tok->t_str); + i++; } b_string_append_cstr(str, ")"); diff --git a/lang/ast/unit-package.c b/lang/ast/unit-package.c index 314807e..3e321fa 100644 --- a/lang/ast/unit-package.c +++ b/lang/ast/unit-package.c @@ -63,16 +63,20 @@ static void to_string(struct ivy_ast_node *node, b_string *str) = (struct ivy_ast_unit_package_node *)node; b_string_append_cstr(str, ivy_ast_node_type_to_string(node->n_type)); + b_string_append_cstr(str, " ("); + + int i = 0; b_queue_iterator it = {0}; b_queue_foreach (&it, &unit_package->n_ident) { struct ivy_token *tok = b_unbox(struct ivy_token, it.entry, t_entry); - if (b_string_get_size(str, B_STRLEN_NORMAL) > 0) { + if (i > 0) { b_string_append_cstr(str, "."); } b_string_append_cstr(str, tok->t_str); + i++; } b_string_append_cstr(str, ")");