Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Not A Bug
-
Affects Version/s: JRuby 1.6.6
-
Fix Version/s: None
-
Component/s: Interpreter
-
Labels:None
-
Number of attachments :
Description
If error is raised in evaled block which is bound to binding and it raises an error, wrong line numbers are reported in backtrace:
arturas@zeus:~/work/spacegame/server$ cat test.rb
def test
do_stuff(binding)
end
def do_stuff(binding) # line 5
binding.eval %Q
end
test
arturas@zeus:~/work/spacegame/server$ ruby test.rb
RuntimeError: error
do_stuff at test.rb:5 <------
eval at org/jruby/RubyKernel.java:1088
eval at org/jruby/RubyBinding.java:134
do_stuff at test.rb:6
test at test.rb:2
(root) at test.rb:14
If binding is not used, everything is ok.
arturas@zeus:~/work/spacegame/server$ cat test.rb
def test
do_stuff(binding)
end
def do_stuff(binding)
eval %Q
end
test
arturas@zeus:~/work/spacegame/server$ ruby test.rb
RuntimeError: error
do_stuff at (eval):5
eval at org/jruby/RubyKernel.java:1088
do_stuff at test.rb:6
test at test.rb:2
(root) at test.rb:14
JIRA ate my formatting
arturas@zeus:~/work/spacegame/server$ cat test.rb def test do_stuff(binding) end def do_stuff(binding) # line 5 binding.eval %Q{ raise 'error' # error is actually raised here } end test arturas@zeus:~/work/spacegame/server$ ruby test.rb RuntimeError: error do_stuff at test.rb:5 <---------- eval at org/jruby/RubyKernel.java:1088 eval at org/jruby/RubyBinding.java:134 do_stuff at test.rb:6 test at test.rb:2 (root) at test.rb:14arturas@zeus:~/work/spacegame/server$ cat test.rb def test do_stuff(binding) end def do_stuff(binding) eval %Q{ raise 'error' } end test arturas@zeus:~/work/spacegame/server$ ruby test.rb RuntimeError: error do_stuff at (eval):5 eval at org/jruby/RubyKernel.java:1088 do_stuff at test.rb:6 test at test.rb:2 (root) at test.rb:14