Use relative positions inside a SourceFile.

This commit is contained in:
Camille GILLOT 2023-09-03 10:15:35 +00:00
parent 585bb5e68d
commit 258ace613d
20 changed files with 217 additions and 281 deletions

View file

@ -267,7 +267,7 @@ impl CodegenCx<'_, '_> {
// Use 1-based indexing.
let line = (line + 1) as u32;
let col = (pos - line_pos).to_u32() + 1;
let col = (file.relative_position(pos) - line_pos).to_u32() + 1;
(file, line, col)
}