mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Compositing NODE_DSTR and NODE_STR
This commit is contained in:
@@ -893,6 +893,21 @@ concat_string(parser_state *p, node *a, node *b)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (string_node_p(b)) {
|
||||
/* a == NODE_DSTR && b == NODE_STR */
|
||||
|
||||
node *c;
|
||||
for (c = a; c->cdr != NULL; c = c->cdr) ;
|
||||
if (string_node_p(c->car)) {
|
||||
/* a->[..., NODE_STR] && b == NODE_STR */
|
||||
composite_string_node(p, c->car->cdr, b->cdr);
|
||||
cons_free(b);
|
||||
return a;
|
||||
}
|
||||
|
||||
push(a, b);
|
||||
return a;
|
||||
}
|
||||
|
||||
return new_dstr(p, list2(a, b));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user