diff options
author | Kevin Newton <kddnewton@gmail.com> | 2024-02-16 13:44:56 -0500 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2024-02-16 20:41:52 +0000 |
commit | 13301587cf04b39ab8683f146ebf6d252d7ff728 (patch) | |
tree | b6d461dfce3006b4ecbd607b4cf8a398c18aca1f /lib/prism/translation/parser | |
parent | 429338a20c4e8472b02bf2092007fdf597c541de (diff) |
[ruby/prism] Fix block_pass for []=
https://github.com/ruby/prism/commit/bf79206220
Diffstat (limited to 'lib/prism/translation/parser')
-rw-r--r-- | lib/prism/translation/parser/compiler.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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, ["="]), |