incr.comp.: Store Spans as (file,line,col,length) in incr.comp. cache.

The previous method ran into problems because ICH would treat Spans
as (file,line,col) but the cache contained byte offsets and its
possible for the latter to change while the former stayed stable.
This commit is contained in:
Michael Woerister 2017-11-24 14:00:33 +01:00
parent 409e39285d
commit 45439945c9
4 changed files with 178 additions and 114 deletions

View file

@ -931,6 +931,11 @@ impl FileMap {
(lines[line_index], lines[line_index + 1])
}
}
#[inline]
pub fn contains(&self, byte_pos: BytePos) -> bool {
byte_pos >= self.start_pos && byte_pos <= self.end_pos
}
}
/// Remove utf-8 BOM if any.