mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Remove Params and Fields from AstIdMap
This commit is contained in:
parent
200a01adc4
commit
9cbafa2d49
16 changed files with 494 additions and 449 deletions
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue