summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/prism/translation/ripper.rb24
-rw-r--r--test/prism/ripper_test.rb3
2 files changed, 18 insertions, 9 deletions
diff --git a/lib/prism/translation/ripper.rb b/lib/prism/translation/ripper.rb
index bb5b2c6003..addeb38fdd 100644
--- a/lib/prism/translation/ripper.rb
+++ b/lib/prism/translation/ripper.rb
@@ -1384,17 +1384,29 @@ module Prism
elements =
if node.elements.any? || !node.rest.nil?
node.elements.map do |element|
- bounds(element.key.location)
- key = on_label(element.key.slice)
- value = visit(element.value)
-
- [key, value]
+ [
+ if (key = element.key).opening_loc.nil?
+ visit(key)
+ else
+ bounds(key.value_loc)
+ if (value = key.value).empty?
+ on_string_content
+ else
+ on_string_add(on_string_content, on_tstring_content(value))
+ end
+ end,
+ visit(element.value)
+ ]
end
end
rest =
- if !node.rest.nil?
+ case node.rest
+ when AssocSplatNode
visit(node.rest.value)
+ when NoKeywordsParameterNode
+ bounds(node.rest.location)
+ on_var_field(:nil)
end
bounds(node.location)
diff --git a/test/prism/ripper_test.rb b/test/prism/ripper_test.rb
index 9f9d5a15ca..9095ab3f99 100644
--- a/test/prism/ripper_test.rb
+++ b/test/prism/ripper_test.rb
@@ -58,7 +58,6 @@ module Prism
seattlerb/call_array_lambda_block_call.txt
seattlerb/call_assoc_trailing_comma.txt
seattlerb/call_trailing_comma.txt
- seattlerb/case_in.txt
seattlerb/defn_oneliner_eq2.txt
seattlerb/defs_oneliner_eq2.txt
seattlerb/difficult3_5.txt
@@ -86,7 +85,6 @@ module Prism
seattlerb/parse_opt_call_args_lit_comma.txt
seattlerb/parse_pattern_051.txt
seattlerb/parse_pattern_058.txt
- seattlerb/parse_pattern_076.txt
seattlerb/return_call_assocs.txt
seattlerb/stabby_block_iter_call.txt
seattlerb/stabby_block_iter_call_no_target_with_arg.txt
@@ -135,7 +133,6 @@ module Prism
whitequark/masgn_attr.txt
whitequark/masgn_nested.txt
whitequark/masgn_splat.txt
- whitequark/newline_in_hash_argument.txt
whitequark/numbered_args_after_27.txt
whitequark/parser_bug_640.txt
whitequark/parser_drops_truncated_parts_of_squiggly_heredoc.txt