Shuffle hir-expand things around

This commit is contained in:
Lukas Wirth 2024-01-25 10:07:29 +01:00
parent e320004dad
commit 880baa9e56
8 changed files with 295 additions and 258 deletions

View file

@ -155,7 +155,14 @@ impl PartialEq for AstIdMap {
impl Eq for AstIdMap {}
impl AstIdMap {
pub(crate) fn from_source(node: &SyntaxNode) -> AstIdMap {
pub(crate) fn ast_id_map(
db: &dyn ExpandDatabase,
file_id: span::HirFileId,
) -> triomphe::Arc<AstIdMap> {
triomphe::Arc::new(AstIdMap::from_source(&db.parse_or_expand(file_id)))
}
fn from_source(node: &SyntaxNode) -> AstIdMap {
assert!(node.parent().is_none());
let mut res = AstIdMap::default();