Skip to content

Commit bf79206

Browse files
committed
Fix block_pass for []=
1 parent e2e0e5a commit bf79206

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/prism/translation/parser/compiler.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,15 @@ def visit_call_node(node)
253253
return visit_block(builder.index(visit(node.receiver), token(node.opening_loc), visit_all(arguments), token(node.closing_loc)), block)
254254
when :[]=
255255
if node.message != "[]=" && node.arguments && block.nil? && !node.safe_navigation?
256+
arguments = node.arguments.arguments[...-1]
257+
arguments << node.block if node.block
258+
256259
return visit_block(
257260
builder.assign(
258261
builder.index_asgn(
259262
visit(node.receiver),
260263
token(node.opening_loc),
261-
visit_all(node.arguments.arguments[...-1]),
264+
visit_all(arguments),
262265
token(node.closing_loc),
263266
),
264267
srange_find(node.message_loc.end_offset, node.arguments.arguments.last.location.start_offset, ["="]),

test/prism/parser_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class ParserTest < TestCase
4646
# These files are either failing to parse or failing to translate, so we'll
4747
# skip them for now.
4848
skip_all = %w[
49-
arrays.txt
5049
constants.txt
5150
dash_heredocs.txt
5251
dos_endings.txt

0 commit comments

Comments
 (0)