Convert code to text-size

This commit is contained in:
Aleksey Kladov 2020-04-24 23:40:41 +02:00
parent 27a7718880
commit b1d5817dd1
75 changed files with 438 additions and 456 deletions

View file

@ -2,7 +2,7 @@
use std::fmt;
use crate::{TextRange, TextUnit};
use crate::{TextRange, TextSize};
/// Represents the result of unsuccessful tokenization, parsing
/// or tree validation.
@ -23,8 +23,8 @@ impl SyntaxError {
pub fn new(message: impl Into<String>, range: TextRange) -> Self {
Self(message.into(), range)
}
pub fn new_at_offset(message: impl Into<String>, offset: TextUnit) -> Self {
Self(message.into(), TextRange::offset_len(offset, 0.into()))
pub fn new_at_offset(message: impl Into<String>, offset: TextSize) -> Self {
Self(message.into(), TextRange::empty(offset))
}
pub fn range(&self) -> TextRange {