Handle tuple fields as well

This commit is contained in:
Aleksey Kladov 2020-02-29 18:35:45 +01:00
parent 14ea21617a
commit 7f09083c6f
2 changed files with 7 additions and 1 deletions

View File

@ -268,6 +268,7 @@ fn to_def<DB: HirDatabase>(sema: &Semantics<DB>, src: InFile<Self>) -> Option<Se
(crate::Static, ast::StaticDef, static_to_def),
(crate::Function, ast::FnDef, fn_to_def),
(crate::StructField, ast::RecordFieldDef, record_field_to_def),
(crate::StructField, ast::TupleFieldDef, tuple_field_to_def),
(crate::EnumVariant, ast::EnumVariant, enum_variant_to_def),
(crate::TypeParam, ast::TypeParam, type_param_to_def),
(crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros

View File

@ -94,13 +94,18 @@ pub(super) fn type_alias_to_def(
) -> Option<TypeAliasId> {
self.to_def(src, keys::TYPE_ALIAS)
}
//TODO: tuple field
pub(super) fn record_field_to_def(
&mut self,
src: InFile<ast::RecordFieldDef>,
) -> Option<StructFieldId> {
self.to_def(src, keys::RECORD_FIELD)
}
pub(super) fn tuple_field_to_def(
&mut self,
src: InFile<ast::TupleFieldDef>,
) -> Option<StructFieldId> {
self.to_def(src, keys::TUPLE_FIELD)
}
pub(super) fn enum_variant_to_def(
&mut self,
src: InFile<ast::EnumVariant>,