1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Return new NODE_LIT

As NODE_ZLIST/NODE_LIST are not markable, cannot be reused as
NODE_LIT.
This commit is contained in:
Nobuyoshi Nakada 2021-01-14 16:15:25 +09:00
parent bb40c5cbe9
commit 6bcc4664bd
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
Notes: git 2021-01-14 16:59:47 +09:00

View file

@ -11148,9 +11148,7 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable,
case NODE_ZLIST:
lit = rb_ary_new();
OBJ_FREEZE_RAW(lit);
nd_set_type(value, NODE_LIT);
RB_OBJ_WRITE(p->ast, &value->nd_lit, lit);
return value;
return NEW_LIT(lit, loc);
case NODE_LIST:
lit = rb_ary_new();
@ -11235,8 +11233,7 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable,
value = make_shareable_node(p, value, false, loc);
}
else {
nd_set_type(value, NODE_LIT);
RB_OBJ_WRITE(p->ast, &value->nd_lit, rb_ractor_make_shareable(lit));
value = NEW_LIT(rb_ractor_make_shareable(lit), loc);
}
return value;