Skip to content

Commit afc7c93

Browse files
committed
(ruby_parser) Handle bare string in implicit concat
1 parent 47cb73c commit afc7c93

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/prism/translation/ruby_parser.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,13 @@ def visit_interpolated_x_string_node(node)
893893
visited << result
894894
end
895895
elsif result[0] == :dstr
896+
if !visited.empty? && part.parts[0].is_a?(StringNode)
897+
# If we are in the middle of an implicitly concatenated string,
898+
# we should not have a bare string as the first part. In this
899+
# case we need to visit just that first part and then we can
900+
# push the rest of the parts onto the visited array.
901+
result[1] = visit(part.parts[0])
902+
end
896903
visited.concat(result[1..-1])
897904
else
898905
visited << result

0 commit comments

Comments
 (0)