operator < method

bool operator <(
  1. SourceLocation other
)

Whether this location is earlier in the file than other.

Can only be used to compare locations in the same source.

Implementation

bool operator <(SourceLocation other) {
  if (source != other.source) {
    throw StateError('Cannot compare locations from different sources.');
  }
  return offset < other.offset;
}