Move AST nodes into each item's struct
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user