コード例 #1
0
 @Override
 @AvailMethod
 void o_SetMethodName(final AvailObject object, final A_String methodName) {
   assert methodName.isString();
   methodName.makeImmutable();
   final A_Atom propertyAtom = object.mutableSlot(PROPERTY_ATOM);
   propertyAtom.setAtomProperty(methodNameKeyAtom(), methodName);
   // Now scan all sub-blocks. Some literals will be functions and some
   // will be compiled code objects.
   int counter = 1;
   for (int i = 1, limit = object.numLiterals(); i <= limit; i++) {
     final AvailObject literal = object.literalAt(i);
     final A_RawFunction subCode;
     if (literal.isFunction()) {
       subCode = literal.code();
     } else if (literal.isInstanceOf(CompiledCodeTypeDescriptor.mostGeneralType())) {
       subCode = literal;
     } else {
       subCode = null;
     }
     if (subCode != null) {
       final String suffix = String.format("[%d]", counter);
       counter++;
       final A_Tuple newName = methodName.concatenateWith(StringDescriptor.from(suffix), true);
       subCode.setMethodName((A_String) newName);
     }
   }
 }
コード例 #2
0
 @Override
 @AvailMethod
 A_Type o_Kind(final AvailObject object) {
   return CompiledCodeTypeDescriptor.forFunctionType(object.functionType());
 }