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:
@@ -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, ")");
|
||||
|
||||
Reference in New Issue
Block a user