예제 #1
0
 private Frame pushFrameForEval(Binding binding) {
   Frame lastFrame = getNextFrame();
   Frame f = pushFrame(binding.getFrame());
   setFileAndLine(binding.getFile(), binding.getLine());
   f.setVisibility(binding.getVisibility());
   return lastFrame;
 }
예제 #2
0
  private Frame pushFrameForBlock(Binding binding) {
    Frame lastFrame = getNextFrame();
    Frame f = pushFrame(binding.getFrame());

    // set the binding's frame's "previous" file and line to current, so
    // trace will show who called the block
    f.setFileAndLine(file, line);

    setFileAndLine(binding.getFile(), binding.getLine());
    f.setVisibility(binding.getVisibility());

    return lastFrame;
  }
예제 #3
0
  public static Block createMethodBlock(
      ThreadContext context, IRubyObject self, DynamicScope dynamicScope, MethodBlock body) {
    RubyMethod method = body.method;
    RubyModule module = method.getMethod().getImplementationClass();
    Frame frame = new Frame();

    frame.setKlazz(module);
    frame.setName(method.getMethodName());
    frame.setSelf(method.receiver(context));
    frame.setVisibility(method.getMethod().getVisibility());

    Binding binding =
        new Binding(
            frame,
            dynamicScope,
            new BacktraceElement(method.getMethodName(), body.getFile(), body.getLine()));

    return new Block(body, binding);
  }