diff options
Diffstat (limited to 'crates/ra_hir/src/semantics/source_to_def.rs')
-rw-r--r-- | crates/ra_hir/src/semantics/source_to_def.rs | 17 |
1 files changed, 7 insertions, 10 deletions
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 | }; |