Arturas Slajus created JRUBY-6369:
-------------------------------------

             Summary: Wrong line numbers reported in stacktrace if using 
binding.eval
                 Key: JRUBY-6369
                 URL: https://jira.codehaus.org/browse/JRUBY-6369
             Project: JRuby
          Issue Type: Bug
          Components: Interpreter
    Affects Versions: JRuby 1.6.6
            Reporter: Arturas Slajus
            Priority: Minor


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{



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: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{



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


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to