aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-02-29 17:35:45 +0000
committerAleksey Kladov <[email protected]>2020-02-29 17:35:45 +0000
commit7f09083c6ff3cb3499b140ffe85f83a06f685aed (patch)
treec6ee7fbbfca890fbbd8e26e1f98e11b6d49492e6 /crates
parent14ea21617ab510daa4f88b0f7c93fdfd2d36e42d (diff)
Handle tuple fields as well
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/semantics.rs1
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs7
2 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 60392947e..74901e318 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -268,6 +268,7 @@ to_def_impls![
268 (crate::Static, ast::StaticDef, static_to_def), 268 (crate::Static, ast::StaticDef, static_to_def),
269 (crate::Function, ast::FnDef, fn_to_def), 269 (crate::Function, ast::FnDef, fn_to_def),
270 (crate::StructField, ast::RecordFieldDef, record_field_to_def), 270 (crate::StructField, ast::RecordFieldDef, record_field_to_def),
271 (crate::StructField, ast::TupleFieldDef, tuple_field_to_def),
271 (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), 272 (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),
272 (crate::TypeParam, ast::TypeParam, type_param_to_def), 273 (crate::TypeParam, ast::TypeParam, type_param_to_def),
273 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros 274 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 303610dc4..884b535b2 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -94,13 +94,18 @@ impl<DB: HirDatabase> SourceToDefCtx<'_, &'_ DB> {
94 ) -> Option<TypeAliasId> { 94 ) -> Option<TypeAliasId> {
95 self.to_def(src, keys::TYPE_ALIAS) 95 self.to_def(src, keys::TYPE_ALIAS)
96 } 96 }
97 //TODO: tuple field
98 pub(super) fn record_field_to_def( 97 pub(super) fn record_field_to_def(
99 &mut self, 98 &mut self,
100 src: InFile<ast::RecordFieldDef>, 99 src: InFile<ast::RecordFieldDef>,
101 ) -> Option<StructFieldId> { 100 ) -> Option<StructFieldId> {
102 self.to_def(src, keys::RECORD_FIELD) 101 self.to_def(src, keys::RECORD_FIELD)
103 } 102 }
103 pub(super) fn tuple_field_to_def(
104 &mut self,
105 src: InFile<ast::TupleFieldDef>,
106 ) -> Option<StructFieldId> {
107 self.to_def(src, keys::TUPLE_FIELD)
108 }
104 pub(super) fn enum_variant_to_def( 109 pub(super) fn enum_variant_to_def(
105 &mut self, 110 &mut self,
106 src: InFile<ast::EnumVariant>, 111 src: InFile<ast::EnumVariant>,