Actions
Bug #22450
openJump value attaches block in incorrect place under parse.y
Bug #22450:
Jump value attaches block in incorrect place under parse.y
Description
Sorry about this one. The following code: check 1, if true then return foo + bar do end end under Prism:
-e: warning: argument of top-level return is ignored
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,49)>
0000 putself ( 1)[Li]
0001 putobject_INT2FIX_1_
0002 adjuststack 2
0004 putself
0005 opt_send_without_block <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0007 putself
0008 send <calldata!mid:bar, argc:0, FCALL>, block in <main>
0011 opt_plus <calldata!mid:+, argc:1, ARGS_SIMPLE>[CcCr]
0013 leave [Re]
0014 putnil
0015 opt_send_without_block <calldata!mid:check, argc:2, FCALL|ARGS_SIMPLE>
0017 leave
== disasm: #<ISeq:block in <main>@-e:1 (1,39)-(1,45)>
0000 putnil ( 1)[Bc]
0001 leave [Br]
but under parse.y:
-e: warning: argument of top-level return is ignored
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,49)>
0000 putself ( 1)[Li]
0001 putobject_INT2FIX_1_
0002 adjuststack 2
0004 putself
0005 opt_send_without_block <calldata!mid:foo, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0007 putself
0008 opt_send_without_block <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0010 send <calldata!mid:+, argc:1>, block in <main>
0013 leave [Re]
0014 putnil
0015 opt_send_without_block <calldata!mid:check, argc:2, FCALL|ARGS_SIMPLE>
0017 leave
== disasm: #<ISeq:block in <main>@-e:1 (1,39)-(1,45)>
0000 putnil ( 1)[Bc]
0001 leave [Br]
The block is getting attached to the + operation. I think the problem with this is that when a block is found after a jump, parse.y blindly attaches the block to whatever it finds in the value position.
No data to display
Actions