Ejemplo n.º 1
0
  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);
  }
Ejemplo n.º 2
0
  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;
  }
Ejemplo n.º 3
0
  @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;
  }
Ejemplo n.º 4
0
 protected SetDispatchNode rewrite(SetDispatchNode next) {
   CompilerAsserts.neverPartOfCompilation();
   assert this != next;
   return replace(next);
 }