mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-17 02:42:54 +00:00
Remove ast ids from item tree mod items
This commit is contained in:
parent
65e2e2c083
commit
048a01a05d
4 changed files with 122 additions and 162 deletions
|
|
@ -168,8 +168,8 @@ impl<'a> Ctx<'a> {
|
|||
let name = strukt.name()?.as_name();
|
||||
let ast_id = self.source_ast_id_map.ast_id(strukt);
|
||||
let shape = adt_shape(strukt.kind());
|
||||
let res = Struct { name, visibility, shape, ast_id };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::Struct(res));
|
||||
let res = Struct { name, visibility, shape };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Struct(res));
|
||||
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -178,7 +178,7 @@ impl<'a> Ctx<'a> {
|
|||
let visibility = self.lower_visibility(union);
|
||||
let name = union.name()?.as_name();
|
||||
let ast_id = self.source_ast_id_map.ast_id(union);
|
||||
let res = Union { name, visibility, ast_id };
|
||||
let res = Union { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Union(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -187,7 +187,7 @@ impl<'a> Ctx<'a> {
|
|||
let visibility = self.lower_visibility(enum_);
|
||||
let name = enum_.name()?.as_name();
|
||||
let ast_id = self.source_ast_id_map.ast_id(enum_);
|
||||
let res = Enum { name, visibility, ast_id };
|
||||
let res = Enum { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Enum(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ impl<'a> Ctx<'a> {
|
|||
|
||||
let ast_id = self.source_ast_id_map.ast_id(func);
|
||||
|
||||
let res = Function { name, visibility, ast_id };
|
||||
let res = Function { name, visibility };
|
||||
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Function(res));
|
||||
Some(ast_id)
|
||||
|
|
@ -211,7 +211,7 @@ impl<'a> Ctx<'a> {
|
|||
let name = type_alias.name()?.as_name();
|
||||
let visibility = self.lower_visibility(type_alias);
|
||||
let ast_id = self.source_ast_id_map.ast_id(type_alias);
|
||||
let res = TypeAlias { name, visibility, ast_id };
|
||||
let res = TypeAlias { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::TypeAlias(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -220,7 +220,7 @@ impl<'a> Ctx<'a> {
|
|||
let name = static_.name()?.as_name();
|
||||
let visibility = self.lower_visibility(static_);
|
||||
let ast_id = self.source_ast_id_map.ast_id(static_);
|
||||
let res = Static { name, visibility, ast_id };
|
||||
let res = Static { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Static(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -229,7 +229,7 @@ impl<'a> Ctx<'a> {
|
|||
let name = konst.name().map(|it| it.as_name());
|
||||
let visibility = self.lower_visibility(konst);
|
||||
let ast_id = self.source_ast_id_map.ast_id(konst);
|
||||
let res = Const { name, visibility, ast_id };
|
||||
let res = Const { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Const(res));
|
||||
ast_id
|
||||
}
|
||||
|
|
@ -251,7 +251,7 @@ impl<'a> Ctx<'a> {
|
|||
}
|
||||
};
|
||||
let ast_id = self.source_ast_id_map.ast_id(module);
|
||||
let res = Mod { name, visibility, kind, ast_id };
|
||||
let res = Mod { name, visibility, kind };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::Mod(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ impl<'a> Ctx<'a> {
|
|||
let visibility = self.lower_visibility(trait_def);
|
||||
let ast_id = self.source_ast_id_map.ast_id(trait_def);
|
||||
|
||||
let def = Trait { name, visibility, ast_id };
|
||||
let def = Trait { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Trait(def));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ impl<'a> Ctx<'a> {
|
|||
let visibility = self.lower_visibility(trait_alias_def);
|
||||
let ast_id = self.source_ast_id_map.ast_id(trait_alias_def);
|
||||
|
||||
let alias = TraitAlias { name, visibility, ast_id };
|
||||
let alias = TraitAlias { name, visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::TraitAlias(alias));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -283,7 +283,7 @@ impl<'a> Ctx<'a> {
|
|||
let ast_id = self.source_ast_id_map.ast_id(impl_def);
|
||||
// Note that trait impls don't get implicit `Self` unlike traits, because here they are a
|
||||
// type alias rather than a type parameter, so this is handled by the resolver.
|
||||
let res = Impl { ast_id };
|
||||
let res = Impl {};
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Impl(res));
|
||||
ast_id
|
||||
}
|
||||
|
|
@ -295,7 +295,7 @@ impl<'a> Ctx<'a> {
|
|||
self.span_map().span_for_range(range).ctx
|
||||
})?;
|
||||
|
||||
let res = Use { visibility, ast_id, use_tree };
|
||||
let res = Use { visibility, use_tree };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::Use(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ impl<'a> Ctx<'a> {
|
|||
let visibility = self.lower_visibility(extern_crate);
|
||||
let ast_id = self.source_ast_id_map.ast_id(extern_crate);
|
||||
|
||||
let res = ExternCrate { name, alias, visibility, ast_id };
|
||||
let res = ExternCrate { name, alias, visibility };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::ExternCrate(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -325,8 +325,8 @@ impl<'a> Ctx<'a> {
|
|||
})?);
|
||||
let ast_id = self.source_ast_id_map.ast_id(m);
|
||||
let expand_to = hir_expand::ExpandTo::from_call_site(m);
|
||||
let res = MacroCall { path, ast_id, expand_to, ctxt: span_map.span_for_range(range).ctx };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::MacroCall(res));
|
||||
let res = MacroCall { path, expand_to, ctxt: span_map.span_for_range(range).ctx };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::MacroCall(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +334,7 @@ impl<'a> Ctx<'a> {
|
|||
let name = m.name()?;
|
||||
let ast_id = self.source_ast_id_map.ast_id(m);
|
||||
|
||||
let res = MacroRules { name: name.as_name(), ast_id };
|
||||
let res = MacroRules { name: name.as_name() };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::MacroRules(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -345,7 +345,7 @@ impl<'a> Ctx<'a> {
|
|||
let ast_id = self.source_ast_id_map.ast_id(m);
|
||||
let visibility = self.lower_visibility(m);
|
||||
|
||||
let res = Macro2 { name: name.as_name(), ast_id, visibility };
|
||||
let res = Macro2 { name: name.as_name(), visibility };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::Macro2(res));
|
||||
Some(ast_id)
|
||||
}
|
||||
|
|
@ -372,8 +372,8 @@ impl<'a> Ctx<'a> {
|
|||
.collect()
|
||||
});
|
||||
|
||||
let res = ExternBlock { ast_id, children };
|
||||
self.tree.big_data.insert(ast_id.upcast(), BigModItem::ExternBlock(res));
|
||||
let res = ExternBlock { children };
|
||||
self.tree.small_data.insert(ast_id.upcast(), SmallModItem::ExternBlock(res));
|
||||
ast_id
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue