mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
new_dstr: hoisted out from literal_concat and evstr2dstr
This commit is contained in:
parent
6321330461
commit
93b78abd77
1 changed files with 12 additions and 6 deletions
18
parse.y
18
parse.y
|
@ -481,6 +481,7 @@ static NODE *last_arg_append(struct parser_params *p, NODE *args, NODE *last_arg
|
||||||
static NODE *rest_arg_append(struct parser_params *p, NODE *args, NODE *rest_arg, const YYLTYPE *loc);
|
static NODE *rest_arg_append(struct parser_params *p, NODE *args, NODE *rest_arg, const YYLTYPE *loc);
|
||||||
static NODE *literal_concat(struct parser_params*,NODE*,NODE*,const YYLTYPE*);
|
static NODE *literal_concat(struct parser_params*,NODE*,NODE*,const YYLTYPE*);
|
||||||
static NODE *new_evstr(struct parser_params*,NODE*,const YYLTYPE*);
|
static NODE *new_evstr(struct parser_params*,NODE*,const YYLTYPE*);
|
||||||
|
static NODE *new_dstr(struct parser_params*,NODE*,const YYLTYPE*);
|
||||||
static NODE *evstr2dstr(struct parser_params*,NODE*);
|
static NODE *evstr2dstr(struct parser_params*,NODE*);
|
||||||
static NODE *splat_array(NODE*);
|
static NODE *splat_array(NODE*);
|
||||||
static void mark_lvar_used(struct parser_params *p, NODE *rhs);
|
static void mark_lvar_used(struct parser_params *p, NODE *rhs);
|
||||||
|
@ -9882,9 +9883,7 @@ literal_concat(struct parser_params *p, NODE *head, NODE *tail, const YYLTYPE *l
|
||||||
|
|
||||||
htype = nd_type(head);
|
htype = nd_type(head);
|
||||||
if (htype == NODE_EVSTR) {
|
if (htype == NODE_EVSTR) {
|
||||||
NODE *node = NEW_DSTR(STR_NEW0(), loc);
|
head = new_dstr(p, head, loc);
|
||||||
RB_OBJ_WRITTEN(p->ast, Qnil, node->nd_lit);
|
|
||||||
head = list_append(p, node, head);
|
|
||||||
htype = NODE_DSTR;
|
htype = NODE_DSTR;
|
||||||
}
|
}
|
||||||
if (p->heredoc_indent > 0) {
|
if (p->heredoc_indent > 0) {
|
||||||
|
@ -9964,9 +9963,7 @@ static NODE *
|
||||||
evstr2dstr(struct parser_params *p, NODE *node)
|
evstr2dstr(struct parser_params *p, NODE *node)
|
||||||
{
|
{
|
||||||
if (nd_type(node) == NODE_EVSTR) {
|
if (nd_type(node) == NODE_EVSTR) {
|
||||||
NODE * dstr = NEW_DSTR(STR_NEW0(), &node->nd_loc);
|
node = new_dstr(p, node, &node->nd_loc);
|
||||||
RB_OBJ_WRITTEN(p->ast, Qnil, dstr->nd_lit);
|
|
||||||
node = list_append(p, dstr, node);
|
|
||||||
}
|
}
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -9985,6 +9982,15 @@ new_evstr(struct parser_params *p, NODE *node, const YYLTYPE *loc)
|
||||||
return NEW_EVSTR(head, loc);
|
return NEW_EVSTR(head, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NODE *
|
||||||
|
new_dstr(struct parser_params *p, NODE *node, const YYLTYPE *loc)
|
||||||
|
{
|
||||||
|
VALUE lit = STR_NEW0();
|
||||||
|
NODE *dstr = NEW_DSTR(lit, loc);
|
||||||
|
RB_OBJ_WRITTEN(p->ast, Qnil, lit);
|
||||||
|
return list_append(p, dstr, node);
|
||||||
|
}
|
||||||
|
|
||||||
static NODE *
|
static NODE *
|
||||||
call_bin_op(struct parser_params *p, NODE *recv, ID id, NODE *arg1,
|
call_bin_op(struct parser_params *p, NODE *recv, ID id, NODE *arg1,
|
||||||
const YYLTYPE *op_loc, const YYLTYPE *loc)
|
const YYLTYPE *op_loc, const YYLTYPE *loc)
|
||||||
|
|
Loading…
Reference in a new issue