distance method

int distance (SourceLocation other)

Returns the distance in characters between this and other.

This always returns a non-negative value.

Implementation

int distance(SourceLocation other) {
  if (sourceUrl != other.sourceUrl) {
    throw new ArgumentError("Source URLs \"${sourceUrl}\" and "
        "\"${other.sourceUrl}\" don't match.");
  }
  return (offset - other.offset).abs();
}