lang: update bluelib api usage
This commit is contained in:
@@ -128,35 +128,36 @@ static enum ivy_status state_init(
|
||||
static void serialise_selector(
|
||||
struct ivy_ast_selector_node *sel, b_stringstream *out)
|
||||
{
|
||||
b_stringstream_add(out, "_M");
|
||||
b_stream_write_string(out, "_M", NULL);
|
||||
|
||||
if (sel->n_msg_name) {
|
||||
const char *msg_name = sel->n_msg_name->t_str;
|
||||
b_stringstream_addf(out, "%zu%s", strlen(msg_name), msg_name);
|
||||
b_stream_write_fmt(out, NULL, "%zu%s", strlen(msg_name), msg_name);
|
||||
} else {
|
||||
b_stringstream_add(out, "0");
|
||||
b_stream_write_char(out, '0');
|
||||
}
|
||||
|
||||
b_queue_iterator it;
|
||||
b_queue_foreach (&it, &sel->n_arg_labels) {
|
||||
struct ivy_token *arg
|
||||
= b_unbox(struct ivy_token, it.entry, t_entry);
|
||||
b_queue_entry *entry = b_queue_first(&sel->n_arg_labels);
|
||||
while (entry) {
|
||||
struct ivy_token *arg = b_unbox(struct ivy_token, entry, t_entry);
|
||||
|
||||
if (arg->t_type != IVY_TOK_IDENT && arg->t_type != IVY_TOK_LABEL) {
|
||||
b_stringstream_addf(out, "0");
|
||||
continue;
|
||||
b_stream_write_char(out, '0');
|
||||
goto next;
|
||||
}
|
||||
|
||||
const char *label = arg->t_str;
|
||||
|
||||
if (label) {
|
||||
b_stringstream_addf(out, "%zu%s", strlen(label), label);
|
||||
b_stream_write_fmt(out, NULL, "%zu%s", strlen(label), label);
|
||||
} else {
|
||||
b_stringstream_addf(out, "0");
|
||||
b_stream_write_char(out, '0');
|
||||
}
|
||||
next:
|
||||
entry = b_queue_next(entry);
|
||||
}
|
||||
|
||||
b_stringstream_add(out, "E");
|
||||
b_stream_write_char(out, 'E');
|
||||
}
|
||||
|
||||
static enum ivy_status state_fini(
|
||||
@@ -167,10 +168,11 @@ static enum ivy_status state_fini(
|
||||
|
||||
struct msg_codegen_state *msg = (struct msg_codegen_state *)state;
|
||||
|
||||
b_stringstream str;
|
||||
b_stringstream_begin_dynamic(&str);
|
||||
serialise_selector(msg->s_selector, &str);
|
||||
char *sel = b_stringstream_end(&str);
|
||||
b_stringstream *str = b_stringstream_create();
|
||||
serialise_selector(msg->s_selector, str);
|
||||
char *sel = b_stringstream_steal(str);
|
||||
b_stringstream_unref(str);
|
||||
|
||||
struct mie_value *sel_value = mie_ctx_get_selector(gen->c_ctx, sel);
|
||||
free(sel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user