diff --git a/lib/prism/translation/parser/compiler.rb b/lib/prism/translation/parser/compiler.rb index 81156a64c7..423df8fb8c 100644 --- a/lib/prism/translation/parser/compiler.rb +++ b/lib/prism/translation/parser/compiler.rb @@ -253,12 +253,15 @@ module Prism return visit_block(builder.index(visit(node.receiver), token(node.opening_loc), visit_all(arguments), token(node.closing_loc)), block) when :[]= if node.message != "[]=" && node.arguments && block.nil? && !node.safe_navigation? + arguments = node.arguments.arguments[...-1] + arguments << node.block if node.block + return visit_block( builder.assign( builder.index_asgn( visit(node.receiver), token(node.opening_loc), - visit_all(node.arguments.arguments[...-1]), + visit_all(arguments), token(node.closing_loc), ), srange_find(node.message_loc.end_offset, node.arguments.arguments.last.location.start_offset, ["="]), diff --git a/test/prism/parser_test.rb b/test/prism/parser_test.rb index 853ac536ee..087cf72292 100644 --- a/test/prism/parser_test.rb +++ b/test/prism/parser_test.rb @@ -46,7 +46,6 @@ module Prism # These files are either failing to parse or failing to translate, so we'll # skip them for now. skip_all = %w[ - arrays.txt constants.txt dash_heredocs.txt dos_endings.txt