leo icon indicating copy to clipboard operation
leo copied to clipboard

AST: Use structs of enums instead of enums of structs

Open Centril opened this issue 3 years ago • 0 comments

This primarily relates to how spans are stored. Instead of having e.g., Expr::Foo(Span, rest) and Expr::Bar(Span, rest), which unnecessarily complicates code, we should instead store things as Expr { span: Span, kind: ExprKind } with ExprKind::Foo(rest) and ExprKind::Bar(rest). This is how the rustc compiler stores things.

Centril avatar Jul 19 '22 14:07 Centril