mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
2c62beb6b6
commit
0c6edda08c
2 changed files with 6 additions and 0 deletions
2
parse.y
2
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -759,6 +759,10 @@ eom
|
|||
assert_syntax_error('<<~ "#{}"', /unexpected <</)
|
||||
end
|
||||
|
||||
def test_dedented_heredoc_concatenation
|
||||
assert_equal("\n0\n1", eval("<<~0 '1'\n \n0\#{}\n0"))
|
||||
end
|
||||
|
||||
def test_lineno_operation_brace_block
|
||||
expected = __LINE__ + 1
|
||||
actual = caller_lineno\
|
||||
|
|
Loading…
Reference in a new issue