示例#1
0
 @Override
 public Instr cloneForInlining(InlinerInfo ii) {
   return new ToAryInstr(
       (Variable) result.cloneForInlining(ii),
       array.cloneForInlining(ii),
       (BooleanLiteral) dontToAryArrays.cloneForInlining(ii));
 }
示例#2
0
  @Override
  public Object interpret(
      ThreadContext context,
      DynamicScope currDynScope,
      IRubyObject self,
      Object[] temp,
      Block block) {
    Object receiver = array.retrieve(context, self, currDynScope, temp);

    // Don't call to_ary if we we have an array already and we are asked not to run to_ary on arrays
    if (dontToAryArrays.isTrue() && receiver instanceof RubyArray) {
      return receiver;
    } else {
      return RuntimeHelpers.aryToAry((IRubyObject) receiver);
    }
  }
示例#3
0
 @Override
 public Operand simplifyAndGetResult(IRScope scope, Map<Operand, Operand> valueMap) {
   simplifyOperands(valueMap, false);
   return dontToAryArrays.isTrue() && (array.getValue(valueMap) instanceof Array) ? array : null;
 }