From 6d69bb433609e082079c367f14bac1c9be1b632e Mon Sep 17 00:00:00 2001 From: Marceline Cramer Date: Fri, 8 May 2026 14:46:24 -0600 Subject: [PATCH] Move AST nodes into each item's struct --- crates/frontend/src/ast.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/frontend/src/ast.rs b/crates/frontend/src/ast.rs index 122dcb6..7398022 100644 --- a/crates/frontend/src/ast.rs +++ b/crates/frontend/src/ast.rs @@ -75,20 +75,17 @@ pub fn items<'db>(db: &'db dyn Database, file: workspace::File) -> Vec(db: &'db dyn Database, meta: ItemMeta<'db>) -> WithAst> { - 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.