From 89a907ddd0b7f6b888c61d54e3e41a8cee00b971 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Tue, 20 Feb 2024 02:18:36 +0200 Subject: expand type expansion --- include/ek/ast.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/ek/ast.h b/include/ek/ast.h index ab727eb..7ab03ae 100644 --- a/include/ek/ast.h +++ b/include/ek/ast.h @@ -370,20 +370,16 @@ struct trait_implemented { struct trait_implemented *next; }; -/** - * A trait declaration. - * - * @todo should templates take decls or should it just be for structures? - */ +/** A trait definition. */ struct ast_trait { /** Name of trait. */ struct ast_node *id; /** Parameters to construct concrete type from trait. */ struct ast_node *params; + /** Raw body before expansion. */ + struct ast_node *raw_body; /** Body of trait. */ struct ast_node *body; - /** List of types that implement this trait. */ - struct trait_implemented *impl_by; }; /** Cast. */ @@ -676,6 +672,7 @@ struct ast_struct { struct ast_node *generics; /** Body. */ struct ast_node *body; + struct trait_implemented *implemented_by; }; /** Enum member constant value. */ @@ -1116,7 +1113,7 @@ struct ast_node *gen_alias(struct ast_node *id, struct ast_node *type, struct sr * @return Corresponding AST node. */ struct ast_node *gen_trait(struct ast_node *id, struct ast_node *params, - struct ast_node *body, struct src_loc loc); + struct ast_node *raw_body, struct ast_node *body, struct src_loc loc); /** * Generate import; -- cgit v1.3