From 8fc20b65035d93bcc1b3a89127916bd165a8d938 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Dec 2019 11:59:50 +0100 Subject: Rename ContainerId -> AssocContainerId --- crates/ra_hir_def/src/body/lower.rs | 4 ++-- crates/ra_hir_def/src/data.rs | 12 ++++++------ crates/ra_hir_def/src/lib.rs | 18 +++++++++--------- crates/ra_hir_def/src/nameres/collector.rs | 8 ++++---- crates/ra_hir_def/src/resolver.rs | 16 ++++++++-------- 5 files changed, 29 insertions(+), 29 deletions(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 17efa10e2..afd5231cc 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -25,7 +25,7 @@ use crate::{ path::GenericArgs, path::Path, type_ref::{Mutability, TypeRef}, - ContainerId, DefWithBodyId, FunctionLoc, Intern, + AssocContainerId, DefWithBodyId, FunctionLoc, Intern, }; pub(super) fn lower( @@ -490,7 +490,7 @@ where } fn collect_block_items(&mut self, block: &ast::Block) { - let container = ContainerId::DefWithBodyId(self.def); + let container = AssocContainerId::DefWithBodyId(self.def); for item in block.items() { match item { ast::ModuleItem::FnDef(def) => { diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 4f4ef57cc..14e86936b 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -12,8 +12,8 @@ use crate::{ db::DefDatabase, src::HasSource, type_ref::{Mutability, TypeRef}, - AssocItemId, ConstId, ConstLoc, ContainerId, FunctionId, FunctionLoc, ImplId, Intern, Lookup, - StaticId, TraitId, TypeAliasId, TypeAliasLoc, + AssocContainerId, AssocItemId, ConstId, ConstLoc, FunctionId, FunctionLoc, ImplId, Intern, + Lookup, StaticId, TraitId, TypeAliasId, TypeAliasLoc, }; #[derive(Debug, Clone, PartialEq, Eq)] @@ -99,7 +99,7 @@ impl TraitData { let auto = src.value.is_auto(); let ast_id_map = db.ast_id_map(src.file_id); - let container = ContainerId::TraitId(tr); + let container = AssocContainerId::TraitId(tr); let items = if let Some(item_list) = src.value.item_list() { item_list .impl_items() @@ -180,7 +180,7 @@ impl ImplData { .map(|item_node| match item_node { ast::ImplItem::FnDef(it) => { let def = FunctionLoc { - container: ContainerId::ImplId(id), + container: AssocContainerId::ImplId(id), ast_id: AstId::new(src.file_id, items.ast_id(&it)), } .intern(db); @@ -188,7 +188,7 @@ impl ImplData { } ast::ImplItem::ConstDef(it) => { let def = ConstLoc { - container: ContainerId::ImplId(id), + container: AssocContainerId::ImplId(id), ast_id: AstId::new(src.file_id, items.ast_id(&it)), } .intern(db); @@ -196,7 +196,7 @@ impl ImplData { } ast::ImplItem::TypeAliasDef(it) => { let def = TypeAliasLoc { - container: ContainerId::ImplId(id), + container: AssocContainerId::ImplId(id), ast_id: AstId::new(src.file_id, items.ast_id(&it)), } .intern(db); diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 4fc3127c4..3d42762ae 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -71,7 +71,7 @@ impl_intern_key!(FunctionId); #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct FunctionLoc { - pub container: ContainerId, + pub container: AssocContainerId, pub ast_id: AstId, } @@ -187,7 +187,7 @@ pub struct ConstId(salsa::InternId); impl_intern_key!(ConstId); #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ConstLoc { - pub container: ContainerId, + pub container: AssocContainerId, pub ast_id: AstId, } @@ -259,7 +259,7 @@ impl_intern_key!(TypeAliasId); #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct TypeAliasLoc { - pub container: ContainerId, + pub container: AssocContainerId, pub ast_id: AstId, } @@ -331,7 +331,7 @@ pub struct LocalTypeParamId(RawId); impl_arena_id!(LocalTypeParamId); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] -pub enum ContainerId { +pub enum AssocContainerId { ModuleId(ModuleId), ImplId(ImplId), TraitId(TraitId), @@ -479,13 +479,13 @@ pub trait HasModule { fn module(&self, db: &impl db::DefDatabase) -> ModuleId; } -impl HasModule for ContainerId { +impl HasModule for AssocContainerId { fn module(&self, db: &impl db::DefDatabase) -> ModuleId { match *self { - ContainerId::ModuleId(it) => it, - ContainerId::ImplId(it) => it.lookup(db).container, - ContainerId::TraitId(it) => it.lookup(db).container, - ContainerId::DefWithBodyId(it) => it.module(db), + AssocContainerId::ModuleId(it) => it, + AssocContainerId::ImplId(it) => it.lookup(db).container, + AssocContainerId::TraitId(it) => it.lookup(db).container, + AssocContainerId::DefWithBodyId(it) => it.module(db), } } } diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 8bbf7ffa2..848959f7c 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -24,7 +24,7 @@ use crate::{ }, path::{ModPath, PathKind}, per_ns::PerNs, - AdtId, AstId, ConstLoc, ContainerId, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, + AdtId, AssocContainerId, AstId, ConstLoc, EnumLoc, EnumVariantId, FunctionLoc, ImplLoc, Intern, LocalImportId, LocalModuleId, ModuleDefId, ModuleId, StaticLoc, StructLoc, TraitLoc, TypeAliasLoc, UnionLoc, }; @@ -763,7 +763,7 @@ where let def: PerNs = match def.kind { raw::DefKind::Function(ast_id) => { let def = FunctionLoc { - container: ContainerId::ModuleId(module), + container: AssocContainerId::ModuleId(module), ast_id: AstId::new(self.file_id, ast_id), } .intern(self.def_collector.db); @@ -787,7 +787,7 @@ where } raw::DefKind::Const(ast_id) => { let def = ConstLoc { - container: ContainerId::ModuleId(module), + container: AssocContainerId::ModuleId(module), ast_id: AstId::new(self.file_id, ast_id), } .intern(self.def_collector.db); @@ -808,7 +808,7 @@ where } raw::DefKind::TypeAlias(ast_id) => { let def = TypeAliasLoc { - container: ContainerId::ModuleId(module), + container: AssocContainerId::ModuleId(module), ast_id: AstId::new(self.file_id, ast_id), } .intern(self.def_collector.db); diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 250329271..d79c9813b 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs @@ -17,9 +17,9 @@ use crate::{ nameres::{BuiltinShadowMode, CrateDefMap}, path::{ModPath, PathKind}, per_ns::PerNs, - AdtId, ConstId, ContainerId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId, - HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId, StructId, TraitId, - TypeAliasId, TypeParamId, VariantId, + AdtId, AssocContainerId, ConstId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, + GenericDefId, HasModule, ImplId, LocalModuleId, Lookup, ModuleDefId, ModuleId, StaticId, + StructId, TraitId, TypeAliasId, TypeParamId, VariantId, }; #[derive(Debug, Clone, Default)] @@ -580,13 +580,13 @@ impl HasResolver for DefWithBodyId { } } -impl HasResolver for ContainerId { +impl HasResolver for AssocContainerId { fn resolver(self, db: &impl DefDatabase) -> Resolver { match self { - ContainerId::TraitId(it) => it.resolver(db), - ContainerId::ImplId(it) => it.resolver(db), - ContainerId::ModuleId(it) => it.resolver(db), - ContainerId::DefWithBodyId(it) => it.resolver(db), + AssocContainerId::TraitId(it) => it.resolver(db), + AssocContainerId::ImplId(it) => it.resolver(db), + AssocContainerId::ModuleId(it) => it.resolver(db), + AssocContainerId::DefWithBodyId(it) => it.resolver(db), } } } -- cgit v1.2.3