Esempio n. 1
0
 /**
  * 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();
 }
Esempio n. 2
0
 /**
  * Write a JSON object whose fields are the {@linkplain ModuleRoots module roots} and whose values
  * are {@linkplain ModuleRoot#writePathsOn(JSONWriter) JSON arrays} containing path information.
  *
  * @param writer A {@link JSONWriter}.
  */
 public void writePathsOn(final JSONWriter writer) {
   writer.startObject();
   for (final ModuleRoot root : roots()) {
     writer.write(root.name());
     root.writePathsOn(writer);
   }
   writer.endObject();
 }
Esempio n. 3
0
  /**
   * Create the JSON representation of the signature.
   *
   * @param nameOfGroup The name of the implementation as it is to be displayed.
   * @param sticky whether or no the method is private and should be documented
   * @param jsonWriter The {@linkplain JSONWriter writer} collecting the stacks content.
   */
  public void toJSON(final String nameOfGroup, final boolean sticky, final JSONWriter jsonWriter) {
    jsonWriter.write("sticky");
    jsonWriter.write(sticky);
    jsonWriter.write("source");

    if (!name().equals(nameOfGroup)) {
      final StringBuilder stringBuilder = new StringBuilder();
      stringBuilder.append(module()).append(": ").append(name());
      jsonWriter.write(stringBuilder.toString());
    } else {
      jsonWriter.write(module());
    }
  }
Esempio n. 4
0
 @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();
 }
 @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();
 }