distance method

int distance(
  1. 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 ArgumentError('Source URLs "$sourceUrl" and '
        "\"${other.sourceUrl}\" don't match.");
  }
  return (offset - other.offset).abs();
}