Exemplo n.º 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);
 }
Exemplo n.º 2
0
 @TruffleBoundary
 @Specialization
 public DynamicObject toS(DynamicObject value, NotProvided base) {
   return create7BitString(
       StringOperations.encodeByteList(
           Layouts.BIGNUM.getValue(value).toString(), USASCIIEncoding.INSTANCE));
 }
Exemplo n.º 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();
    }
  }
Exemplo n.º 5
0
 @Override
 public Object isDefined(VirtualFrame frame) {
   return create7BitString(
       StringOperations.encodeByteList(Boolean.toString(value), UTF8Encoding.INSTANCE));
 }