Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  *
  * <p>Show the types of local variables and outer variables.
  */
 @Override
 AvailObjectFieldHelper[] o_DescribeForDebugger(final AvailObject object) {
   final List<AvailObjectFieldHelper> fields = new ArrayList<>();
   fields.addAll(Arrays.asList(super.o_DescribeForDebugger(object)));
   for (int i = 1, end = object.numOuters(); i <= end; i++) {
     fields.add(
         new AvailObjectFieldHelper(object, FakeSlots.OUTER_TYPE_, i, object.outerTypeAt(i)));
   }
   for (int i = 1, end = object.numLocals(); i <= end; i++) {
     fields.add(
         new AvailObjectFieldHelper(object, FakeSlots.LOCAL_TYPE_, i, object.localTypeAt(i)));
   }
   final StringBuilder disassembled = new StringBuilder();
   object.printOnAvoidingIndent(disassembled, new IdentityHashMap<A_BasicObject, Void>(), 0);
   final String[] content = disassembled.toString().split("\n");
   fields.add(new AvailObjectFieldHelper(object, FakeSlots.L1_DISASSEMBLY, -1, content));
   final List<AvailObject> allLiterals = new ArrayList<>();
   for (int i = 1; i <= object.numLiterals(); i++) {
     allLiterals.add(object.literalAt(i));
   }
   fields.add(
       new AvailObjectFieldHelper(
           object, FakeSlots.ALL_LITERALS, -1, TupleDescriptor.fromList(allLiterals)));
   return fields.toArray(new AvailObjectFieldHelper[fields.size()]);
 }
Exemplo n.º 2
0
 @Override
 @AvailMethod
 A_Type o_OuterTypeAt(final AvailObject object, final int index) {
   assert 1 <= index && index <= object.numOuters();
   return object.literalAt(object.numLiterals() - object.numLocals() - object.numOuters() + index);
 }