Пример #1
0
 public Object isDefined(VirtualFrame frame) {
   return Layouts.STRING.createString(
       Layouts.CLASS.getInstanceFactory(getContext().getCoreLibrary().getStringClass()),
       StringOperations.encodeByteList("expression", UTF8Encoding.INSTANCE),
       StringSupport.CR_7BIT,
       null);
 }
Пример #2
0
 @TruffleBoundary
 @Specialization
 public DynamicObject toS(DynamicObject value, NotProvided base) {
   return create7BitString(
       StringOperations.encodeByteList(
           Layouts.BIGNUM.getValue(value).toString(), USASCIIEncoding.INSTANCE));
 }
Пример #3
0
    @TruffleBoundary
    @Specialization
    public DynamicObject toS(DynamicObject value, int base) {
      if (base < 2 || base > 36) {
        CompilerDirectives.transferToInterpreter();
        throw new RaiseException(
            getContext().getCoreLibrary().argumentErrorInvalidRadix(base, this));
      }

      return create7BitString(
          StringOperations.encodeByteList(
              Layouts.BIGNUM.getValue(value).toString(base), USASCIIEncoding.INSTANCE));
    }
  @Override
  public Object isDefined(VirtualFrame frame) {
    CompilerDirectives.transferToInterpreter();
    final DynamicObject threadLocalVariablesObject =
        threadLocalVariablesObjectNode.executeDynamicObject(frame);

    if (readNode.getName().equals("$~")
        || readNode.getName().equals("$!")
        || readNode.execute(threadLocalVariablesObject) != nil()) {
      return create7BitString(
          StringOperations.encodeByteList("global-variable", UTF8Encoding.INSTANCE));
    } else {
      return nil();
    }
  }
Пример #5
0
 @Override
 public Object isDefined(VirtualFrame frame) {
   return create7BitString(
       StringOperations.encodeByteList(Boolean.toString(value), UTF8Encoding.INSTANCE));
 }