Issue Type: Bug Bug
Assignee: Thomas E Enebo
Created: 12/Aug/12 1:12 AM
Description:
set_trace_func(proc{ |event, file, line, method, binding, klass|
  puts binding.eval("[self, s]").inspect if event == "raise"
})

def hello
  s = "snorkle"
  s.desnrok
end

hello
# output:
# ["snorkle", "snorkle"]
# NoMethodError: undefined method `desnrok' for "snorkle":String
#   hello at a.rb:7
#  (root) at a.rb +10

Both 's' and 'self' are "snorkle" — 'self' in this case should be main.

I'm bringing this up because I encountered the same problem when calling ThreadContext#currentBinding() in interception: https://github.com/ConradIrwin/interception/blob/master/ext/org/pryrepl/InterceptionEventHook.java

In this case the problem could be fixed by using ThreadContext#previousBinding(), but I'm unable to decide at runtime which one should be used (always using previousBinding() causes other cases to fail).

The promising looking ThreadContext#getCurrentRubyFrame() seems to not help as it is the same as ThreadContext#currentFrame().

Project: JRuby
Priority: Trivial Trivial
Reporter: Conrad Irwin
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
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