Move AST nodes into each item's struct

This commit is contained in:
2026-05-08 14:46:24 -06:00
parent 13dbda7f65
commit 6d69bb4336

View File

@@ -75,20 +75,17 @@ pub fn items<'db>(db: &'db dyn Database, file: workspace::File) -> Vec<ItemMeta<
}
/// Parses an [ItemMeta] into its corresponding [Item].
pub fn item<'db>(db: &'db dyn Database, meta: ItemMeta<'db>) -> WithAst<Item<'db>> {
use Item::*;
pub fn item<'db>(db: &'db dyn Database, meta: ItemMeta<'db>) -> Item<'db> {
let ast = meta.ast(db);
let item = match meta.kind(db) {
use Item::*;
match meta.kind(db) {
ItemKind::Relation => Relation(relation(db, ast)),
ItemKind::TypeAlias => TypeAlias(type_alias(db, ast)),
ItemKind::Import => Import(import(db, ast)),
ItemKind::Rule => Rule(rule(db, ast)),
ItemKind::Assumption => Assumption(assumption(db, ast)),
};
WithAst::new(ast, item)
}
}
/// Common information on top-level items.