File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1696,11 +1696,19 @@ def visit_interpolated_regular_expression_node(node)
1696
1696
# "foo #{bar}"
1697
1697
# ^^^^^^^^^^^^
1698
1698
def visit_interpolated_string_node ( node )
1699
- if node . opening . start_with? ( "<<~" )
1699
+ if node . opening & .start_with? ( "<<~" )
1700
1700
heredoc = visit_string_heredoc_node ( node . parts )
1701
1701
1702
1702
bounds ( node . location )
1703
1703
on_string_literal ( heredoc )
1704
+ elsif !node . heredoc? && node . parts . length > 1 && node . parts . any? { |part | ( part . is_a? ( StringNode ) || part . is_a? ( InterpolatedStringNode ) ) && !part . opening_loc . nil? }
1705
+ first , *rest = node . parts
1706
+ rest . inject ( visit ( first ) ) do |content , part |
1707
+ concat = visit ( part )
1708
+
1709
+ bounds ( part . location )
1710
+ on_string_concat ( content , concat )
1711
+ end
1704
1712
else
1705
1713
bounds ( node . parts . first . location )
1706
1714
parts =
Original file line number Diff line number Diff line change @@ -61,14 +61,11 @@ class RipperTest < TestCase
61
61
seattlerb/lambda_do_vs_brace.txt
62
62
seattlerb/parse_line_dstr_escaped_newline.txt
63
63
seattlerb/parse_line_dstr_soft_newline.txt
64
- seattlerb/parse_line_evstr_after_break.txt
65
64
seattlerb/parse_pattern_051.txt
66
65
seattlerb/parse_pattern_058.txt
67
66
seattlerb/stabby_block_iter_call.txt
68
67
seattlerb/stabby_block_iter_call_no_target_with_arg.txt
69
- seattlerb/str_lit_concat_bad_encodings.txt
70
68
spanning_heredoc.txt
71
- strings.txt
72
69
tilde_heredocs.txt
73
70
unparser/corpus/literal/assignment.txt
74
71
unparser/corpus/literal/block.txt
@@ -96,10 +93,8 @@ class RipperTest < TestCase
96
93
whitequark/parser_drops_truncated_parts_of_squiggly_heredoc.txt
97
94
whitequark/parser_slash_slash_n_escaping_in_literals.txt
98
95
whitequark/ruby_bug_11107.txt
99
- whitequark/ruby_bug_11990.txt
100
96
whitequark/send_block_chain_cmd.txt
101
97
whitequark/slash_newline_in_heredocs.txt
102
- whitequark/string_concat.txt
103
98
]
104
99
105
100
relatives . each do |relative |
You can’t perform that action at this time.
0 commit comments