run method

List<RetracedLine> run (List<String> trace)

Implementation

List<RetracedLine> run(List<String> trace) {
  var output = <RetracedLine>[];
  for(String text in trace) {
    var lineCol = parseLine(text);
    if (lineCol == null) {
      output.add(new RetracedLine.notParsed(text));
      continue;
    }
    var span = _mapping.spanFor(lineCol.line - 1, lineCol.col - 1);
    if (span == null) {
      // source_maps 0.10 fails to locate too low column numbers when target entries wrap lines
      // therefore, make a new search with the preceding line
      span = _mapping.spanFor(lineCol.line - 2, 99999);
      if (span == null) {
        output.add(new RetracedLine.notLocated(text));
        continue;
      }
    }

    var source = p.prettyUri(span.sourceUrl);
    if (source != null) {
      var parts = source.split("/");
      if (parts.length > 3) {
        parts = parts.sublist(parts.length - 3);
      }
      source = parts.join("/");
    } else {
      source = "";
    }
    output.add(new RetracedLine(source, text, span.start.line + 1, span.start.column + 1));
  };
  return output;
}