# class org::jruby::runtime::ThreadContext

### Public Instance Methods

binding_of_caller(index) click to toggle source

    # File lib/binding_of_caller/jruby_interpreted.rb, line 99
    def binding_of_caller(index)
      unless JRuby.runtime.instance_config.compile_mode == CompileMode::OFF
        raise RuntimeError, "caller binding only supported in interpreter"
      end

      index += 1 # always omit this frame

      return nil if index > frameIndex

      frame = frameStack[frameIndex - index]

      return binding_of_caller(index - 1) if index > scopeIndex

      scope = scopeStack[scopeIndex - index]
      element = backtrace[backtraceIndex - index]

      binding = Binding.new(frame, scope.static_scope.module, scope, element.clone)

      BindingOfCaller::JRubyBindingHolder.new(binding)
    end