From a1e18695548b5cd6661f26a985b34c8b105e1896 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 29 Feb 2020 21:24:40 +0100 Subject: Rename ast::ImplBlock -> ast::ImplDef --- crates/ra_hir_def/src/body/lower.rs | 2 +- crates/ra_hir_def/src/data.rs | 6 +++--- crates/ra_hir_def/src/keys.rs | 2 +- crates/ra_hir_def/src/lang_item.rs | 10 +++++----- crates/ra_hir_def/src/lib.rs | 2 +- crates/ra_hir_def/src/nameres/raw.rs | 6 +++--- crates/ra_hir_def/src/resolver.rs | 20 ++++++++++---------- 7 files changed, 24 insertions(+), 24 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 b3fb6d452..c18e6879b 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -544,7 +544,7 @@ where let ast_id = self.expander.ast_id(&def); (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) } - ast::ModuleItem::ImplBlock(_) + ast::ModuleItem::ImplDef(_) | ast::ModuleItem::UseItem(_) | ast::ModuleItem::ExternCrateItem(_) | ast::ModuleItem::Module(_) => continue, diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index c900a6a18..c5fb9428e 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -238,16 +238,16 @@ impl ConstData { fn collect_impl_items_in_macros( db: &impl DefDatabase, module_id: ModuleId, - impl_block: &InFile, + impl_def: &InFile, id: ImplId, ) -> Vec { - let mut expander = Expander::new(db, impl_block.file_id, module_id); + let mut expander = Expander::new(db, impl_def.file_id, module_id); let mut res = Vec::new(); // We set a limit to protect against infinite recursion let limit = 100; - for m in impl_block.value.syntax().children().filter_map(ast::MacroCall::cast) { + for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) { res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) } diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index 5913f12b1..8cd70eb9a 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -18,7 +18,7 @@ pub const FUNCTION: Key = Key::new(); pub const CONST: Key = Key::new(); pub const STATIC: Key = Key::new(); pub const TYPE_ALIAS: Key = Key::new(); -pub const IMPL: Key = Key::new(); +pub const IMPL: Key = Key::new(); pub const TRAIT: Key = Key::new(); pub const STRUCT: Key = Key::new(); pub const UNION: Key = Key::new(); diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs index 37c861a87..5a336ea1f 100644 --- a/crates/ra_hir_def/src/lang_item.rs +++ b/crates/ra_hir_def/src/lang_item.rs @@ -16,7 +16,7 @@ use crate::{ pub enum LangItemTarget { EnumId(EnumId), FunctionId(FunctionId), - ImplBlockId(ImplId), + ImplDefId(ImplId), StaticId(StaticId), StructId(StructId), TraitId(TraitId), @@ -37,9 +37,9 @@ impl LangItemTarget { } } - pub fn as_impl_block(self) -> Option { + pub fn as_impl_def(self) -> Option { match self { - LangItemTarget::ImplBlockId(id) => Some(id), + LangItemTarget::ImplDefId(id) => Some(id), _ => None, } } @@ -125,8 +125,8 @@ impl LangItems { // Look for impl targets let def_map = db.crate_def_map(module.krate); let module_data = &def_map[module.local_id]; - for impl_block in module_data.scope.impls() { - self.collect_lang_item(db, impl_block, LangItemTarget::ImplBlockId) + for impl_def in module_data.scope.impls() { + self.collect_lang_item(db, impl_def, LangItemTarget::ImplDefId) } for def in module_data.scope.declarations() { diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 564b5fec5..c9b14d0c8 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -164,7 +164,7 @@ impl_intern!(TypeAliasId, TypeAliasLoc, intern_type_alias, lookup_intern_type_al #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ImplId(salsa::InternId); -type ImplLoc = ItemLoc; +type ImplLoc = ItemLoc; impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 0e8c9da76..ea3c00da8 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs @@ -213,7 +213,7 @@ impl_arena_id!(Impl); #[derive(Debug, PartialEq, Eq)] pub(super) struct ImplData { - pub(super) ast_id: FileAstId, + pub(super) ast_id: FileAstId, } struct RawItemsCollector { @@ -249,7 +249,7 @@ impl RawItemsCollector { self.add_extern_crate_item(current_module, extern_crate); return; } - ast::ModuleItem::ImplBlock(it) => { + ast::ModuleItem::ImplDef(it) => { self.add_impl(current_module, it); return; } @@ -395,7 +395,7 @@ impl RawItemsCollector { self.push_item(current_module, attrs, RawItemKind::Macro(m)); } - fn add_impl(&mut self, current_module: Option, imp: ast::ImplBlock) { + fn add_impl(&mut self, current_module: Option, imp: ast::ImplDef) { let attrs = self.parse_attrs(&imp); let ast_id = self.source_ast_id_map.ast_id(&imp); let imp = self.raw_items.impls.alloc(ImplData { ast_id }); diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 9dd4fa555..2734d51a0 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs @@ -52,7 +52,7 @@ enum Scope { /// Brings the generic parameters of an item into scope GenericParams { def: GenericDefId, params: Arc }, /// Brings `Self` in `impl` block into scope - ImplBlockScope(ImplId), + ImplDefScope(ImplId), /// Brings `Self` in enum, struct and union definitions into scope AdtScope(AdtId), /// Local bindings @@ -154,7 +154,7 @@ impl Resolver { match scope { Scope::ExprScope(_) => continue, Scope::GenericParams { .. } - | Scope::ImplBlockScope(_) + | Scope::ImplDefScope(_) | Scope::LocalItemsScope(_) if skip_to_mod => { @@ -170,7 +170,7 @@ impl Resolver { )); } } - Scope::ImplBlockScope(impl_) => { + Scope::ImplDefScope(impl_) => { if first_name == &name![Self] { let idx = if path.segments.len() == 1 { None } else { Some(1) }; return Some((TypeNs::SelfType(*impl_), idx)); @@ -263,7 +263,7 @@ impl Resolver { Scope::AdtScope(_) | Scope::ExprScope(_) | Scope::GenericParams { .. } - | Scope::ImplBlockScope(_) + | Scope::ImplDefScope(_) | Scope::LocalItemsScope(_) if skip_to_mod => { @@ -291,7 +291,7 @@ impl Resolver { } Scope::GenericParams { .. } => continue, - Scope::ImplBlockScope(impl_) if n_segments > 1 => { + Scope::ImplDefScope(impl_) if n_segments > 1 => { if first_name == &name![Self] { let ty = TypeNs::SelfType(*impl_); return Some(ResolveValueResult::Partial(ty, 1)); @@ -303,7 +303,7 @@ impl Resolver { return Some(ResolveValueResult::Partial(ty, 1)); } } - Scope::ImplBlockScope(_) | Scope::AdtScope(_) => continue, + Scope::ImplDefScope(_) | Scope::AdtScope(_) => continue, Scope::ModuleScope(m) => { let (module_def, idx) = m.crate_def_map.resolve_path( @@ -503,7 +503,7 @@ impl Scope { } } } - Scope::ImplBlockScope(i) => { + Scope::ImplDefScope(i) => { f(name![Self], ScopeDef::ImplSelfType(*i)); } Scope::AdtScope(i) => { @@ -550,8 +550,8 @@ impl Resolver { self.push_scope(Scope::GenericParams { def, params }) } - fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver { - self.push_scope(Scope::ImplBlockScope(impl_block)) + fn push_impl_def_scope(self, impl_def: ImplId) -> Resolver { + self.push_scope(Scope::ImplDefScope(impl_def)) } fn push_module_scope( @@ -634,7 +634,7 @@ impl HasResolver for ImplId { .container .resolver(db) .push_generic_params_scope(db, self.into()) - .push_impl_block_scope(self) + .push_impl_def_scope(self) } } -- cgit v1.2.3