From 7b2bea42a245f2e80b5d2700963fd6b143f6d6b8 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 2 Sep 2020 23:12:22 +0900 Subject: Unfreeze string-literal-only interpolated string-literal [Feature #17104] --- ast.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'ast.c') 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: -- cgit v1.2.1