From 0c6edda08c5c571029d099fc3d34350ea669e067 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 31 Oct 2018 02:57:30 +0000 Subject: [PATCH] parse.y: last node of NODE_ARRAY * parse.y (heredoc_dedent): manage the last node of NODE_ARRAY, when concatenating dedented literals. [ruby-core:89649] [Bug #15272] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 2 ++ test/ruby/test_syntax.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/parse.y b/parse.y index 21be51cb74..8dcc25bfea 100644 --- a/parse.y +++ b/parse.y @@ -6134,12 +6134,14 @@ heredoc_dedent(struct parser_params *p, NODE *root) return 0; } else { + NODE *end = node->nd_end; node = prev_node->nd_next = node->nd_next; if (!node) { if (nd_type(prev_node) == NODE_DSTR) nd_set_type(prev_node, NODE_STR); break; } + node->nd_end = end; goto next_str; } diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index 28f563046f..bd9c996138 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -759,6 +759,10 @@ eom assert_syntax_error('<<~ "#{}"', /unexpected <