Use lazy initialization for SourceCodeLocator (#472)

This commit is contained in:
Charlie Marsh 2022-10-26 11:27:48 -04:00 committed by GitHub
parent 2679db1d10
commit 4beea0484a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 112 additions and 94 deletions

View file

@ -25,9 +25,9 @@ pub fn leading_space(line: &str) -> String {
}
/// Extract the leading indentation from a docstring.
pub fn indentation<'a>(checker: &'a mut Checker, docstring: &Expr) -> &'a str {
pub fn indentation<'a>(checker: &'a Checker, docstring: &Expr) -> &'a str {
let range = Range::from_located(docstring);
checker.locator.slice_source_code_range(&Range {
checker.get_locator().slice_source_code_range(&Range {
location: Location::new(range.location.row(), 1),
end_location: Location::new(range.location.row(), range.location.column()),
})