@Specialization
    public Object send(RubyBasicObject self, Object[] args, RubyProc block) {
      notDesignedForCompilation();

      final String name = args[0].toString();
      final Object[] sendArgs = Arrays.copyOfRange(args, 1, args.length);
      return self.send(name, block, sendArgs);
    }
    @Specialization
    public Object methodMissing(RubyBasicObject self, Object[] args, RubyProc block) {
      notDesignedForCompilation();

      CompilerDirectives.transferToInterpreter();

      final RubySymbol name = (RubySymbol) args[0];
      final Object[] sentArgs = Arrays.copyOfRange(args, 1, args.length);
      return methodMissing(self, name, sentArgs, block);
    }
    @Specialization
    public Object send(
        RubyBasicObject self,
        Object[] args,
        @SuppressWarnings("unused") UndefinedPlaceholder block) {
      notDesignedForCompilation();

      final String name = args[0].toString();
      final Object[] sendArgs = Arrays.copyOfRange(args, 1, args.length);
      return self.send(name, null, sendArgs);
    }
    @Specialization
    public Object methodMissing(
        RubyBasicObject self,
        Object[] args,
        @SuppressWarnings("unused") UndefinedPlaceholder block) {
      notDesignedForCompilation();

      CompilerDirectives.transferToInterpreter();

      final RubySymbol name = (RubySymbol) args[0];
      final Object[] sentArgs = Arrays.copyOfRange(args, 1, args.length);
      return methodMissing(self, name, sentArgs, null);
    }
Esempio n. 5
0
  @Override
  public Object execute(VirtualFrame frame) {
    final RubyArguments rubyArguments = frame.getArguments(RubyArguments.class);

    final Object[] arguments = rubyArguments.getArguments();

    final RubyClass arrayClass = getContext().getCoreLibrary().getArrayClass();

    if (arguments.length <= index) {
      return new RubyArray(arrayClass);
    } else if (index == 0) {
      return new RubyArray(arrayClass, new ObjectArrayStore(arguments));
    } else {
      return new RubyArray(
          arrayClass, new ObjectArrayStore(Arrays.copyOfRange(arguments, index, arguments.length)));
    }
  }