コード例 #1
0
 @Override
 void o_WriteSummaryTo(final AvailObject object, final JSONWriter writer) {
   writer.startObject();
   writer.write("kind");
   writer.write("function implementation");
   writer.write("outers");
   writer.write(object.slot(NUM_OUTERS));
   writer.write("arguments");
   writer.write(object.slot(NUM_ARGS));
   writer.write("locals");
   writer.write(object.slot(NUM_LOCALS));
   writer.write("maximum stack depth");
   writer.write(object.slot(FRAME_SLOTS));
   writer.write("nybbles");
   object.slot(NYBBLES).writeTo(writer);
   writer.write("function type");
   object.slot(FUNCTION_TYPE).writeSummaryTo(writer);
   writer.write("method");
   object.methodName().writeTo(writer);
   writer.write("module");
   object.module().moduleName().writeTo(writer);
   writer.write("starting line number");
   writer.write(object.startingLineNumber());
   writer.write("literals");
   writer.startArray();
   for (int i = 1, limit = object.variableObjectSlotsCount(); i <= limit; i++) {
     A_BasicObject literal = object.slot(LITERAL_AT_, i);
     if (literal.equalsNil()) {
       literal = IntegerDescriptor.zero();
     }
     literal.writeSummaryTo(writer);
   }
   writer.endArray();
   writer.endObject();
 }
コード例 #2
0
ファイル: ModuleRoots.java プロジェクト: AvailLang/Avail
 /**
  * Write a JSON encoding of the {@linkplain ModuleRoots module roots} to the specified {@link
  * JSONWriter}.
  *
  * @param writer A {@code JSONWriter}.
  */
 public void writeOn(final JSONWriter writer) {
   writer.startArray();
   for (final ModuleRoot root : roots()) {
     writer.write(root.name());
   }
   writer.endArray();
 }
コード例 #3
0
ファイル: StacksReturnTag.java プロジェクト: AvailLang/Avail
 @Override
 public void toJSON(
     final LinkingFileMap linkingFileMap,
     final int hashID,
     final StacksErrorLog errorLog,
     final int position,
     final JSONWriter jsonWriter) {
   jsonWriter.write("returns");
   jsonWriter.startArray();
   jsonWriter.write(returnType.toJSON(linkingFileMap, hashID, errorLog, jsonWriter));
   returnDescription.toJSON(linkingFileMap, hashID, errorLog, jsonWriter);
   jsonWriter.write(linkingFileMap.internalLinks().get(returnType.lexeme()));
   jsonWriter.endArray();
 }