Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/src.rs')
| -rw-r--r-- | crates/hir-def/src/src.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/crates/hir-def/src/src.rs b/crates/hir-def/src/src.rs index a0d2079e0d..6db20870cf 100644 --- a/crates/hir-def/src/src.rs +++ b/crates/hir-def/src/src.rs @@ -6,9 +6,12 @@ use la_arena::ArenaMap; use syntax::{ast, AstNode, AstPtr}; use crate::{ - data::adt::lower_struct, db::DefDatabase, item_tree::ItemTreeNode, trace::Trace, GenericDefId, - ItemTreeLoc, LocalFieldId, LocalLifetimeParamId, LocalTypeOrConstParamId, Lookup, UseId, - VariantId, + data::adt::lower_struct, + db::DefDatabase, + item_tree::{FieldParent, ItemTreeNode}, + trace::Trace, + GenericDefId, ItemTreeLoc, LocalFieldId, LocalLifetimeParamId, LocalTypeOrConstParamId, Lookup, + UseId, VariantId, }; pub trait HasSource { @@ -124,13 +127,13 @@ impl HasChildSource<LocalFieldId> for VariantId { fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<LocalFieldId, Self::Value>> { let item_tree; - let (src, fields, container) = match *self { + let (src, parent, container) = match *self { VariantId::EnumVariantId(it) => { let lookup = it.lookup(db); item_tree = lookup.id.item_tree(db); ( lookup.source(db).map(|it| it.kind()), - &item_tree[lookup.id.value].fields, + FieldParent::Variant(lookup.id.value), lookup.parent.lookup(db).container, ) } @@ -139,7 +142,7 @@ impl HasChildSource<LocalFieldId> for VariantId { item_tree = lookup.id.item_tree(db); ( lookup.source(db).map(|it| it.kind()), - &item_tree[lookup.id.value].fields, + FieldParent::Struct(lookup.id.value), lookup.container, ) } @@ -148,13 +151,13 @@ impl HasChildSource<LocalFieldId> for VariantId { item_tree = lookup.id.item_tree(db); ( lookup.source(db).map(|it| it.kind()), - &item_tree[lookup.id.value].fields, + FieldParent::Union(lookup.id.value), lookup.container, ) } }; let mut trace = Trace::new_for_map(); - lower_struct(db, &mut trace, &src, container.krate, &item_tree, fields); + lower_struct(db, &mut trace, &src, container.krate, &item_tree, parent); src.with_value(trace.into_map()) } } |