lang: codegen: fix segfault when serialising selector with unnamed args

This commit is contained in:
2025-04-22 21:31:44 +01:00
parent 833c80534e
commit 07d16e7454

View File

@@ -122,9 +122,19 @@ static void serialise_selector(
b_queue_foreach (&it, &sel->n_arg_labels) {
struct ivy_token *arg
= b_unbox(struct ivy_token, it.entry, t_entry);
if (arg->t_type != IVY_TOK_IDENT) {
b_stringstream_addf(out, "0");
continue;
}
const char *label = arg->t_str;
if (label) {
b_stringstream_addf(out, "%zu%s", strlen(label), label);
} else {
b_stringstream_addf(out, "0");
}
}
b_stringstream_add(out, "E");