From 00df339c419fc75af6a939b75be8bef5b5a69732 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 28 Nov 2018 01:48:43 +0300 Subject: rename --- crates/ra_analysis/src/db.rs | 2 +- crates/ra_analysis/src/hir/db.rs | 8 ++++---- crates/ra_analysis/src/hir/mod.rs | 16 ++++++++-------- crates/ra_analysis/src/hir/module/nameres.rs | 14 +++++++------- crates/ra_analysis/src/hir/query_definitions.rs | 8 ++++---- crates/ra_analysis/src/loc2id.rs | 4 ++-- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'crates/ra_analysis') diff --git a/crates/ra_analysis/src/db.rs b/crates/ra_analysis/src/db.rs index d7fffc188..97f170473 100644 --- a/crates/ra_analysis/src/db.rs +++ b/crates/ra_analysis/src/db.rs @@ -127,7 +127,7 @@ salsa::database_storage! { impl hir::db::HirDatabase { fn module_tree() for hir::db::ModuleTreeQuery; fn fn_scopes() for hir::db::FnScopesQuery; - fn _file_items() for hir::db::FileItemsQuery; + fn _file_items() for hir::db::SourceFileItemsQuery; fn _file_item() for hir::db::FileItemQuery; fn _input_module_items() for hir::db::InputModuleItemsQuery; fn _item_map() for hir::db::ItemMapQuery; diff --git a/crates/ra_analysis/src/hir/db.rs b/crates/ra_analysis/src/hir/db.rs index a226e8205..e74fcc8ad 100644 --- a/crates/ra_analysis/src/hir/db.rs +++ b/crates/ra_analysis/src/hir/db.rs @@ -8,7 +8,7 @@ use ra_syntax::{ use crate::{ FileId, db::SyntaxDatabase, - hir::{FileItems, FileItemId}, + hir::{SourceFileItems, SourceFileItemId}, hir::query_definitions, hir::function::{FnId, FnScopes}, hir::module::{ @@ -33,13 +33,13 @@ pub(crate) trait HirDatabase: SyntaxDatabase { use fn query_definitions::fn_syntax; } - fn file_items(file_id: FileId) -> Arc { - type FileItemsQuery; + fn file_items(file_id: FileId) -> Arc { + type SourceFileItemsQuery; storage dependencies; use fn query_definitions::file_items; } - fn file_item(file_id: FileId, file_item_id: FileItemId) -> SyntaxNode { + fn file_item(file_id: FileId, file_item_id: SourceFileItemId) -> SyntaxNode { type FileItemQuery; storage dependencies; use fn query_definitions::file_item; diff --git a/crates/ra_analysis/src/hir/mod.rs b/crates/ra_analysis/src/hir/mod.rs index 3d4a55ca4..aa416df20 100644 --- a/crates/ra_analysis/src/hir/mod.rs +++ b/crates/ra_analysis/src/hir/mod.rs @@ -51,19 +51,19 @@ impl DefId { /// Identifier of item within a specific file. This is stable over reparses, so /// it's OK to use it as a salsa key/value. -pub(crate) type FileItemId = Id; +pub(crate) type SourceFileItemId = Id; -/// Maps item's `SyntaxNode`s to `FileItemId` and back. +/// Maps item's `SyntaxNode`s to `SourceFileItemId` and back. #[derive(Debug, PartialEq, Eq, Default)] -pub(crate) struct FileItems { +pub(crate) struct SourceFileItems { arena: Arena, } -impl FileItems { - fn alloc(&mut self, item: SyntaxNode) -> FileItemId { +impl SourceFileItems { + fn alloc(&mut self, item: SyntaxNode) -> SourceFileItemId { self.arena.alloc(item) } - fn id_of(&self, item: SyntaxNodeRef) -> FileItemId { + fn id_of(&self, item: SyntaxNodeRef) -> SourceFileItemId { let (id, _item) = self .arena .iter() @@ -73,9 +73,9 @@ impl FileItems { } } -impl Index for FileItems { +impl Index for SourceFileItems { type Output = SyntaxNode; - fn index(&self, idx: FileItemId) -> &SyntaxNode { + fn index(&self, idx: SourceFileItemId) -> &SyntaxNode { &self.arena[idx] } } diff --git a/crates/ra_analysis/src/hir/module/nameres.rs b/crates/ra_analysis/src/hir/module/nameres.rs index f7d8c8e8c..9dc54f6c0 100644 --- a/crates/ra_analysis/src/hir/module/nameres.rs +++ b/crates/ra_analysis/src/hir/module/nameres.rs @@ -30,7 +30,7 @@ use crate::{ Cancelable, FileId, loc2id::{DefId, DefLoc}, hir::{ - FileItemId, FileItems, + SourceFileItemId, SourceFileItems, Path, PathKind, HirDatabase, module::{ModuleId, ModuleTree}, @@ -73,7 +73,7 @@ pub(crate) struct InputModuleItems { #[derive(Debug, PartialEq, Eq)] struct ModuleItem { - id: FileItemId, + id: SourceFileItemId, name: SmolStr, kind: SyntaxKind, vis: Vis, @@ -93,7 +93,7 @@ struct Import { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub(crate) struct NamedImport { - file_item_id: FileItemId, + file_item_id: SourceFileItemId, relative_range: TextRange, } @@ -135,7 +135,7 @@ pub(crate) struct Resolution { impl InputModuleItems { pub(in crate::hir) fn new<'a>( - file_items: &FileItems, + file_items: &SourceFileItems, items: impl Iterator>, ) -> InputModuleItems { let mut res = InputModuleItems::default(); @@ -145,7 +145,7 @@ impl InputModuleItems { res } - fn add_item(&mut self, file_items: &FileItems, item: ast::ModuleItem) -> Option<()> { + fn add_item(&mut self, file_items: &SourceFileItems, item: ast::ModuleItem) -> Option<()> { match item { ast::ModuleItem::StructDef(it) => self.items.push(ModuleItem::new(file_items, it)?), ast::ModuleItem::EnumDef(it) => self.items.push(ModuleItem::new(file_items, it)?), @@ -166,7 +166,7 @@ impl InputModuleItems { Some(()) } - fn add_use_item(&mut self, file_items: &FileItems, item: ast::UseItem) { + fn add_use_item(&mut self, file_items: &SourceFileItems, item: ast::UseItem) { let file_item_id = file_items.id_of(item.syntax()); let start_offset = item.syntax().range().start(); Path::expand_use_item(item, |path, range| { @@ -183,7 +183,7 @@ impl InputModuleItems { } impl ModuleItem { - fn new<'a>(file_items: &FileItems, item: impl ast::NameOwner<'a>) -> Option { + fn new<'a>(file_items: &SourceFileItems, item: impl ast::NameOwner<'a>) -> Option { let name = item.name()?.text(); let kind = item.syntax().kind(); let vis = Vis::Other; diff --git a/crates/ra_analysis/src/hir/query_definitions.rs b/crates/ra_analysis/src/hir/query_definitions.rs index e6bfbc6cf..53926cf16 100644 --- a/crates/ra_analysis/src/hir/query_definitions.rs +++ b/crates/ra_analysis/src/hir/query_definitions.rs @@ -12,7 +12,7 @@ use ra_syntax::{ use crate::{ FileId, Cancelable, hir::{ - FileItems, FileItemId, + SourceFileItems, SourceFileItemId, db::HirDatabase, function::{FnId, FnScopes}, module::{ @@ -37,10 +37,10 @@ pub(super) fn fn_scopes(db: &impl HirDatabase, fn_id: FnId) -> Arc { Arc::new(res) } -pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc { +pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc { let source_file = db.file_syntax(file_id); let source_file = source_file.borrowed(); - let mut res = FileItems::default(); + let mut res = SourceFileItems::default(); source_file .syntax() .descendants() @@ -55,7 +55,7 @@ pub(super) fn file_items(db: &impl HirDatabase, file_id: FileId) -> Arc SyntaxNode { db.file_items(file_id)[file_item_id].clone() } diff --git a/crates/ra_analysis/src/loc2id.rs b/crates/ra_analysis/src/loc2id.rs index 8af7b642b..49af19c75 100644 --- a/crates/ra_analysis/src/loc2id.rs +++ b/crates/ra_analysis/src/loc2id.rs @@ -9,7 +9,7 @@ use rustc_hash::FxHashMap; use crate::{ FileId, - hir::{FileItemId, ModuleId}, + hir::{SourceFileItemId, ModuleId}, syntax_ptr::SyntaxPtr, input::SourceRootId, }; @@ -104,7 +104,7 @@ pub(crate) enum DefLoc { }, Item { file_id: FileId, - id: FileItemId, + id: SourceFileItemId, }, } -- cgit v1.2.3