leo
leo copied to clipboard
AST: Use structs of enums instead of enums of structs
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.