From 220d285b4afb250e59a08e9b1ad38c2fc2275782 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 25 Aug 2018 11:44:58 +0300 Subject: rename ParsedFile -> File --- crates/libanalysis/src/lib.rs | 14 +++++++------- crates/libanalysis/src/module_map.rs | 4 ++-- crates/libanalysis/src/symbol_index.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'crates/libanalysis') diff --git a/crates/libanalysis/src/lib.rs b/crates/libanalysis/src/lib.rs index a0f17a689..c84ab6077 100644 --- a/crates/libanalysis/src/lib.rs +++ b/crates/libanalysis/src/lib.rs @@ -27,7 +27,7 @@ use std::{ }; use libsyntax2::{ - ParsedFile, + File, TextUnit, TextRange, SmolStr, ast::{self, AstNode, NameOwner}, SyntaxKind::*, @@ -132,7 +132,7 @@ impl WorldState { impl World { - pub fn file_syntax(&self, file_id: FileId) -> Result { + pub fn file_syntax(&self, file_id: FileId) -> Result { let data = self.file_data(file_id)?; Ok(data.syntax().clone()) } @@ -265,7 +265,7 @@ struct WorldData { struct FileData { text: String, symbols: OnceCell, - syntax: OnceCell, + syntax: OnceCell, lines: OnceCell, } @@ -279,14 +279,14 @@ impl FileData { } } - fn syntax(&self) -> &ParsedFile { + fn syntax(&self) -> &File { self.syntax - .get_or_init(|| ParsedFile::parse(&self.text)) + .get_or_init(|| File::parse(&self.text)) } - fn syntax_transient(&self) -> ParsedFile { + fn syntax_transient(&self) -> File { self.syntax.get().map(|s| s.clone()) - .unwrap_or_else(|| ParsedFile::parse(&self.text)) + .unwrap_or_else(|| File::parse(&self.text)) } fn symbols(&self) -> &FileSymbols { diff --git a/crates/libanalysis/src/module_map.rs b/crates/libanalysis/src/module_map.rs index e8d32928a..6a9104d84 100644 --- a/crates/libanalysis/src/module_map.rs +++ b/crates/libanalysis/src/module_map.rs @@ -4,13 +4,13 @@ use std::{ use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard}; use libsyntax2::{ - ParsedFile, + File, ast::{self, AstNode, NameOwner}, SyntaxNode, SmolStr, }; use {FileId, FileResolver}; -type SyntaxProvider<'a> = dyn Fn(FileId) -> ParsedFile + 'a; +type SyntaxProvider<'a> = dyn Fn(FileId) -> File + 'a; #[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub struct ModuleId(FileId); diff --git a/crates/libanalysis/src/symbol_index.rs b/crates/libanalysis/src/symbol_index.rs index 426de4c76..73cbf5702 100644 --- a/crates/libanalysis/src/symbol_index.rs +++ b/crates/libanalysis/src/symbol_index.rs @@ -1,6 +1,6 @@ use libeditor::{FileSymbol, file_symbols}; use libsyntax2::{ - ParsedFile, + File, SyntaxKind::{self, *}, }; use fst::{self, IntoStreamer, Streamer}; @@ -12,7 +12,7 @@ pub(crate) struct FileSymbols { } impl FileSymbols { - pub(crate) fn new(file: &ParsedFile) -> FileSymbols { + pub(crate) fn new(file: &File) -> FileSymbols { let mut symbols = file_symbols(file) .into_iter() .map(|s| (s.name.as_str().to_lowercase(), s)) -- cgit v1.2.3