writeDebugInfo method

Future<void> writeDebugInfo(
  1. OutputWriter output
)

Implementation

Future<void> writeDebugInfo(OutputWriter output) async {
  output.writeLn("// type arguments[1]:");
  for (var k in typeArgumentsMap().keys) {
    output.writeLn(
      "// ${k.name}[${k.hashCode.toString()}] => ${typeArgumentsMap()[k]!.getDisplayString()}[${typeArgumentsMap()[k].hashCode.toString()}]",
    );
  }

  output.writeLn("// type arguments[2]:");
  for (var k in typeArguments) {
    output.writeLn(
      "// ENCLOSING: ${k.element != null ? (k.element!.enclosingElement.name ?? "XXX") : "NULL"}",
    );
    output.writeLn(
      "// ${k.type.getDisplayString()}[${k.hashCode.toString()}]",
    );
  }

  if (element != null) {
    output.writeLn(
      "// can be singleton: ${canBeSingleton() ? 'TRUE' : 'FALSE'}",
    );
    for (var element in element!.typeParameters) {
      output.writeLn(
        "// parameter: ${element.name} ${element.hashCode.toString()}",
      );
      //lines.add("//parameter: ${element.bound == null ? "NULL" : element.bound.name}");
      //lines.add("//parameter: ${element.instantiate(nullabilitySuffix: NullabilitySuffix.none).element.name}");
    }
    for (var element in element!.thisType.typeArguments) {
      output.writeLn(
        "// argument: ${element.getDisplayString()} ${element.hashCode.toString()}",
      );
    }

    for (var s in element!.allSupertypes) {
      output.writeLn(
        "// parent: ${s.element.displayName} ${s.element.metadata.toString()}",
      );
      for (var element in s.element.typeParameters) {
        output.writeLn(
          "// parameter: ${element.name} ${element.hashCode.toString()}",
        );
        //lines.add("//parameter: ${element.bound == null ? "NULL" : element.bound.name}");
        //lines.add("//parameter: ${element.instantiate(nullabilitySuffix: NullabilitySuffix.none).element.name}");
      }
      for (var element in s.typeArguments) {
        output.writeLn(
          "// argument: ${element.getDisplayString()} ${element.hashCode.toString()}",
        );
      }
    }
    //lines.add("//config: ${json.encode(typeConfig)}");

    for (var p in plugins) {
      output.writeLn("// plugin: ${p.fullName}");
    }

    output.writeLn("// CONFIG");
    typeConfig.forEach((key, value) {
      output.writeLn("// config: $key $value");
    });
    output.writeLn("// TYPE PATH:");
    for (var type in allTypeInfoPath()) {
      output.writeLn("//  ${type.fullName}");
    }
  }
}