Skip to content

Commit 356c97c

Browse files
committed
Refactor symbol ripper translation
1 parent 18dea6c commit 356c97c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/prism/translation/ripper.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,19 @@ def visit_super_node(node)
21652165
# :foo
21662166
# ^^^^
21672167
def visit_symbol_node(node)
2168-
visit_symbol_literal_node(node)
2168+
if (opening = node.opening) && opening.match?(/^%s|['"]$/)
2169+
bounds(node.value_loc)
2170+
content = on_string_content
2171+
2172+
if !(value = node.value).empty?
2173+
content = on_string_add(content, on_tstring_content(value))
2174+
end
2175+
2176+
on_dyna_symbol(content)
2177+
else
2178+
bounds(node.value_loc)
2179+
on_symbol_literal(on_symbol(visit_token(node.value)))
2180+
end
21692181
end
21702182

21712183
# true

0 commit comments

Comments
 (0)