コード例 #1
0
    @Specialization(guards = "isRubyString(index)")
    public Object getIndexString(DynamicObject matchData, DynamicObject index, NotProvided length) {
      CompilerDirectives.transferToInterpreter();

      try {
        final int i = getBackrefNumber(matchData, Layouts.STRING.getByteList(index));

        return getIndex(matchData, i, NotProvided.INSTANCE);
      } catch (final ValueException e) {
        CompilerDirectives.transferToInterpreter();

        throw new RaiseException(
            getContext()
                .getCoreLibrary()
                .indexError(
                    String.format("undefined group name reference: %s", index.toString()), this));
      }
    }
コード例 #2
0
 @Specialization
 public DynamicObject exceptionErrnoError(DynamicObject message, int errno) {
   return getContext().getCoreLibrary().errnoError(errno, message.toString(), this);
 }