Extract LineIndex independent methods from Locator (#13938)

This commit is contained in:
Micha Reiser 2024-10-28 08:53:41 +01:00 committed by GitHub
parent f8eb547fb4
commit 9f3a38d408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
171 changed files with 1348 additions and 1284 deletions

View file

@ -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.