aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-30 14:26:15 +0100
committerGitHub <[email protected]>2020-07-30 14:26:15 +0100
commitee00679331b87dacc5fe608f153be160c1cb144c (patch)
treef80ef7823490a6904b3f7bf57a4609ca4c4743dc /crates/ra_hir
parent96c3ff1c573f97e5089fc0ba01ede6fe43693668 (diff)
parenteb2f8063444b11257111f4f8ade990ec810e0361 (diff)
Merge #5591
5591: Rename TypeAliasDef -> TypeAlias r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/has_source.rs8
-rw-r--r--crates/ra_hir/src/semantics.rs4
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs17
3 files changed, 13 insertions, 16 deletions
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 76c32fc17..1557b7c83 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -81,8 +81,8 @@ impl HasSource for EnumVariant {
81 } 81 }
82} 82}
83impl HasSource for Function { 83impl HasSource for Function {
84 type Ast = ast::FnDef; 84 type Ast = ast::Fn;
85 fn source(self, db: &dyn HirDatabase) -> InFile<ast::FnDef> { 85 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Fn> {
86 self.id.lookup(db.upcast()).source(db.upcast()) 86 self.id.lookup(db.upcast()).source(db.upcast())
87 } 87 }
88} 88}
@@ -105,8 +105,8 @@ impl HasSource for Trait {
105 } 105 }
106} 106}
107impl HasSource for TypeAlias { 107impl HasSource for TypeAlias {
108 type Ast = ast::TypeAliasDef; 108 type Ast = ast::TypeAlias;
109 fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAliasDef> { 109 fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> {
110 self.id.lookup(db.upcast()).source(db.upcast()) 110 self.id.lookup(db.upcast()).source(db.upcast())
111 } 111 }
112} 112}
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 1436b1afe..054405966 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -582,10 +582,10 @@ to_def_impls![
582 (crate::Union, ast::UnionDef, union_to_def), 582 (crate::Union, ast::UnionDef, union_to_def),
583 (crate::Trait, ast::TraitDef, trait_to_def), 583 (crate::Trait, ast::TraitDef, trait_to_def),
584 (crate::ImplDef, ast::ImplDef, impl_to_def), 584 (crate::ImplDef, ast::ImplDef, impl_to_def),
585 (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def), 585 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
586 (crate::Const, ast::ConstDef, const_to_def), 586 (crate::Const, ast::ConstDef, const_to_def),
587 (crate::Static, ast::StaticDef, static_to_def), 587 (crate::Static, ast::StaticDef, static_to_def),
588 (crate::Function, ast::FnDef, fn_to_def), 588 (crate::Function, ast::Fn, fn_to_def),
589 (crate::Field, ast::RecordFieldDef, record_field_to_def), 589 (crate::Field, ast::RecordFieldDef, record_field_to_def),
590 (crate::Field, ast::TupleFieldDef, tuple_field_to_def), 590 (crate::Field, ast::TupleFieldDef, tuple_field_to_def),
591 (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), 591 (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 42e5a1bdb..d23a1974b 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -71,7 +71,7 @@ impl SourceToDefCtx<'_, '_> {
71 pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { 71 pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> {
72 self.to_def(src, keys::IMPL) 72 self.to_def(src, keys::IMPL)
73 } 73 }
74 pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> { 74 pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> {
75 self.to_def(src, keys::FUNCTION) 75 self.to_def(src, keys::FUNCTION)
76 } 76 }
77 pub(super) fn struct_to_def(&mut self, src: InFile<ast::StructDef>) -> Option<StructId> { 77 pub(super) fn struct_to_def(&mut self, src: InFile<ast::StructDef>) -> Option<StructId> {
@@ -89,10 +89,7 @@ impl SourceToDefCtx<'_, '_> {
89 pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> { 89 pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> {
90 self.to_def(src, keys::CONST) 90 self.to_def(src, keys::CONST)
91 } 91 }
92 pub(super) fn type_alias_to_def( 92 pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> {
93 &mut self,
94 src: InFile<ast::TypeAliasDef>,
95 ) -> Option<TypeAliasId> {
96 self.to_def(src, keys::TYPE_ALIAS) 93 self.to_def(src, keys::TYPE_ALIAS)
97 } 94 }
98 pub(super) fn record_field_to_def( 95 pub(super) fn record_field_to_def(
@@ -171,7 +168,7 @@ impl SourceToDefCtx<'_, '_> {
171 let def = self.impl_to_def(container.with_value(it))?; 168 let def = self.impl_to_def(container.with_value(it))?;
172 def.into() 169 def.into()
173 }, 170 },
174 ast::FnDef(it) => { 171 ast::Fn(it) => {
175 let def = self.fn_to_def(container.with_value(it))?; 172 let def = self.fn_to_def(container.with_value(it))?;
176 DefWithBodyId::from(def).into() 173 DefWithBodyId::from(def).into()
177 }, 174 },
@@ -195,7 +192,7 @@ impl SourceToDefCtx<'_, '_> {
195 let def = self.const_to_def(container.with_value(it))?; 192 let def = self.const_to_def(container.with_value(it))?;
196 DefWithBodyId::from(def).into() 193 DefWithBodyId::from(def).into()
197 }, 194 },
198 ast::TypeAliasDef(it) => { 195 ast::TypeAlias(it) => {
199 let def = self.type_alias_to_def(container.with_value(it))?; 196 let def = self.type_alias_to_def(container.with_value(it))?;
200 def.into() 197 def.into()
201 }, 198 },
@@ -213,11 +210,11 @@ impl SourceToDefCtx<'_, '_> {
213 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { 210 for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) {
214 let res: GenericDefId = match_ast! { 211 let res: GenericDefId = match_ast! {
215 match (container.value) { 212 match (container.value) {
216 ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), 213 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
217 ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(), 214 ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(),
218 ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), 215 ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(),
219 ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), 216 ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(),
220 ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(), 217 ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
221 ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), 218 ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(),
222 _ => continue, 219 _ => continue,
223 } 220 }
@@ -233,7 +230,7 @@ impl SourceToDefCtx<'_, '_> {
233 match (container.value) { 230 match (container.value) {
234 ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(), 231 ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(),
235 ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(), 232 ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(),
236 ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), 233 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
237 _ => continue, 234 _ => continue,
238 } 235 }
239 }; 236 };