startLocations method

List<SourceLocation> startLocations()

Returns all start locations of the descendants of this node.

Implementation

List<SourceLocation> startLocations() {
  final result = <SourceLocation>[];

  void loop(List<PrettyNode> nodes) {
    for (final node in nodes) {
      if (node is PrettyElement) {
        loop(node.children);
      } else {
        result.add(node.start);
      }
    }
  }

  loop(children);

  return result..sort((a, b) => a.offset.compareTo(b.offset));
}