mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-22 19:39:58 +00:00
red-knot: source_text
, line_index
, and parsed_module
queries (#11822)
This commit is contained in:
parent
efbf7b14b5
commit
d4dd96d1f4
9 changed files with 194 additions and 16 deletions
|
@ -14,11 +14,12 @@ use crate::SourceLocation;
|
|||
/// Index for fast [byte offset](TextSize) to [`SourceLocation`] conversions.
|
||||
///
|
||||
/// Cloning a [`LineIndex`] is cheap because it only requires bumping a reference count.
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub struct LineIndex {
|
||||
inner: Arc<LineIndexInner>,
|
||||
}
|
||||
|
||||
#[derive(Eq, PartialEq)]
|
||||
struct LineIndexInner {
|
||||
line_starts: Vec<TextSize>,
|
||||
kind: IndexKind,
|
||||
|
@ -268,7 +269,7 @@ impl Debug for LineIndex {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
|
||||
enum IndexKind {
|
||||
/// Optimized index for an ASCII only document
|
||||
Ascii,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue