summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-09-02 23:12:22 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-09-30 22:15:28 +0900
commit7b2bea42a245f2e80b5d2700963fd6b143f6d6b8 (patch)
tree59bc4509242d0be9f92dc8a5a95d65d6903a4455 /ast.c
parent65e8a293892800d2201899de51d19ed7ce362bbf (diff)
Unfreeze string-literal-only interpolated string-literal
[Feature #17104]
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/ast.c b/ast.c
index 87c366550e..2af0b3e530 100644
--- a/ast.c
+++ b/ast.c
@@ -485,9 +485,15 @@ node_children(rb_ast_t *ast, const NODE *node)
case NODE_DXSTR:
case NODE_DREGX:
case NODE_DSYM:
- return rb_ary_new_from_args(3, node->nd_lit,
- NEW_CHILD(ast, node->nd_next->nd_head),
- NEW_CHILD(ast, node->nd_next->nd_next));
+ {
+ NODE *n = node->nd_next;
+ VALUE head = Qnil, next = Qnil;
+ if (n) {
+ head = NEW_CHILD(ast, n->nd_head);
+ next = NEW_CHILD(ast, n->nd_next);
+ }
+ return rb_ary_new_from_args(3, node->nd_lit, head, next);
+ }
case NODE_EVSTR:
return rb_ary_new_from_node_args(ast, 1, node->nd_body);
case NODE_ARGSCAT: