コード例 #1
0
ファイル: ArrayLiteralNode.java プロジェクト: byteit101/jruby
  protected RubyArray makeGeneric(VirtualFrame frame, Object[] alreadyExecuted) {
    CompilerAsserts.neverPartOfCompilation();

    replace(new ObjectArrayLiteralNode(getContext(), getSourceSection(), values));

    final Object[] executedValues = new Object[values.length];

    for (int n = 0; n < values.length; n++) {
      if (n < alreadyExecuted.length) {
        executedValues[n] = alreadyExecuted[n];
      } else {
        executedValues[n] = values[n].execute(frame);
      }
    }

    return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), executedValues);
  }
コード例 #2
0
ファイル: TryNode.java プロジェクト: jwinter/jruby
  private Object handleException(VirtualFrame frame, RuntimeException exception) {
    CompilerAsserts.neverPartOfCompilation();

    final RubyContext context = getContext();

    final RubyBasicObject rubyException =
        ExceptionTranslator.translateException(context, exception);

    context.getCoreLibrary().getGlobalVariablesObject().setInstanceVariable("$!", rubyException);

    for (RescueNode rescue : rescueParts) {
      if (rescue.canHandle(frame, rubyException)) {
        return rescue.execute(frame);
      }
    }

    throw exception;
  }
コード例 #3
0
ファイル: TryNode.java プロジェクト: godfat/jruby
  @ExplodeLoop
  private Object handleException(VirtualFrame frame, RaiseException exception) {
    CompilerAsserts.neverPartOfCompilation();

    notDesignedForCompilation();
    getContext()
        .getCoreLibrary()
        .getGlobalVariablesObject()
        .getOperations()
        .setInstanceVariable(
            getContext().getCoreLibrary().getGlobalVariablesObject(),
            "$!",
            exception.getRubyException());

    for (RescueNode rescue : rescueParts) {
      if (rescue.canHandle(frame, exception.getRubyException())) {
        return rescue.execute(frame);
      }
    }

    throw exception;
  }