mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 12:55:05 +00:00
Extract LineIndex
independent methods from Locator
(#13938)
This commit is contained in:
parent
f8eb547fb4
commit
9f3a38d408
171 changed files with 1348 additions and 1284 deletions
|
@ -4,7 +4,6 @@ use bitflags::bitflags;
|
|||
|
||||
use ruff_index::{newtype_index, IndexSlice, IndexVec};
|
||||
use ruff_python_ast::ExprContext;
|
||||
use ruff_source_file::Locator;
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::scope::ScopeId;
|
||||
|
@ -157,8 +156,8 @@ pub struct UnresolvedReference {
|
|||
|
||||
impl UnresolvedReference {
|
||||
/// Returns the name of the reference.
|
||||
pub fn name<'a>(&self, locator: &Locator<'a>) -> &'a str {
|
||||
locator.slice(self.range)
|
||||
pub fn name<'a>(&self, source: &'a str) -> &'a str {
|
||||
&source[self.range]
|
||||
}
|
||||
|
||||
/// The range of the reference in the source code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue