So we have some outdated exceptions #2416 that need to be removed, but it uncovers some corners in IR that we missed:
jruby -e 'puts "a\nb\nc\n"' | jruby -ne 'break if $_ == "b\n"; puts $_'
In this case it should print 'a\n' and stop but we actually throw a LocalJumpError:
CFG:
BB [1:LBL_2:0]
BB [2:LBL_3:0]
%self = recv_self
line_num(0)
%v_0 = get_global_var($_)
%v_1 = call_1o(NORMAL, ==, %v_0, ["b
"]){1O}
b_false(%v_1, LBL_0:6)
BB [3:LBL_4:4]
throw(LocalJumpError:break)
BB [4:LBL_0:6]
%v_1 = get_global_var($_)
%v_0 = call(FUNCTIONAL, puts, %self, [%v_1])
return(%v_0)
BB [6:LBL_5:10]
return(nil)
This is because we treat the code coming in as a ScriptBody and as a script body we know we cannot raise from it. We can either solve this by adding Ruby code to front and back of the supplied script which will mess up backtraces but not require any changes to IR itself OR we will need to accommodate this as a special type of scope.
So we have some outdated exceptions #2416 that need to be removed, but it uncovers some corners in IR that we missed:
In this case it should print 'a\n' and stop but we actually throw a LocalJumpError:
This is because we treat the code coming in as a ScriptBody and as a script body we know we cannot raise from it. We can either solve this by adding Ruby code to front and back of the supplied script which will mess up backtraces but not require any changes to IR itself OR we will need to accommodate this as a special type of scope.