aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/prism/translation/ripper.rb14
-rw-r--r--test/prism/ripper_test.rb5
2 files changed, 5 insertions, 14 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index cb74883088..32afe7b523 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -343,14 +343,7 @@ module Prism
# { a: 1 }
# ^^^^
def visit_assoc_node(node)
- key =
- if node.key.is_a?(SymbolNode) && node.operator_loc.nil?
- bounds(node.key.location)
- on_label(node.key.slice)
- else
- visit(node.key)
- end
-
+ key = visit(node.key)
value = visit(node.value)
bounds(node.location)
@@ -2486,7 +2479,7 @@ module Prism
# :foo
# ^^^^
def visit_symbol_node(node)
- if (opening = node.opening)&.match?(/^%s|['"]$/)
+ if (opening = node.opening)&.match?(/^%s|['"]:?$/)
bounds(node.value_loc)
content = on_string_content
@@ -2495,6 +2488,9 @@ module Prism
end
on_dyna_symbol(content)
+ elsif (closing = node.closing) == ":"
+ bounds(node.location)
+ on_label("#{node.value}:")
elsif opening.nil? && node.closing_loc.nil?
bounds(node.value_loc)
on_symbol_literal(visit_token(node.value))
diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb
index febded5c41..da13ce1d9e 100644
--- a/test/prism/ripper_test.rb
+++ b/test/prism/ripper_test.rb
@@ -48,7 +48,6 @@ module Prism
seattlerb/block_return.txt
seattlerb/bug_hash_args_trailing_comma.txt
seattlerb/bug_hash_interp_array.txt
- seattlerb/call_args_assoc_quoted.txt
seattlerb/call_args_assoc_trailing_comma.txt
seattlerb/call_args_command.txt
seattlerb/call_array_lambda_block_call.txt
@@ -117,8 +116,6 @@ module Prism
seattlerb/parse_pattern_051.txt
seattlerb/parse_pattern_058.txt
seattlerb/parse_pattern_076.txt
- seattlerb/quoted_symbol_hash_arg.txt
- seattlerb/quoted_symbol_keys.txt
seattlerb/rescue_do_end_ensure_result.txt
seattlerb/rescue_do_end_no_raise.txt
seattlerb/rescue_do_end_raised.txt
@@ -175,7 +172,6 @@ module Prism
whitequark/asgn_mrhs.txt
whitequark/break_block.txt
whitequark/bug_480.txt
- whitequark/bug_do_block_in_hash_brace.txt
whitequark/case_cond_else.txt
whitequark/case_expr_else.txt
whitequark/dedenting_heredoc.txt
@@ -190,7 +186,6 @@ module Prism
whitequark/forwarded_kwrestarg.txt
whitequark/forwarded_kwrestarg_with_additional_kwarg.txt
whitequark/forwarded_restarg.txt
- whitequark/hash_label_end.txt
whitequark/if_elsif.txt
whitequark/kwbegin_compstmt.txt
whitequark/kwoptarg_with_kwrestarg_and_forwarded_args.txt