Skip to content

Commit

Permalink
[ruby/prism] Refactor symbol ripper translation
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed Mar 6, 2024
1 parent 47daf71 commit cb11642
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/prism/translation/ripper.rb
Expand Up @@ -2165,7 +2165,19 @@ def visit_super_node(node)
# :foo
# ^^^^
def visit_symbol_node(node)
visit_symbol_literal_node(node)
if (opening = node.opening) && opening.match?(/^%s|['"]$/)
bounds(node.value_loc)
content = on_string_content

if !(value = node.value).empty?
content = on_string_add(content, on_tstring_content(value))
end

on_dyna_symbol(content)
else
bounds(node.value_loc)
on_symbol_literal(on_symbol(visit_token(node.value)))
end
end

# true
Expand Down

0 comments on commit cb11642

Please sign in to comment.