From 416830b0950f0b32c0cb0526283c1d82d67d898f Mon Sep 17 00:00:00 2001 From: Selimaj Dev Date: Mon, 4 May 2026 16:59:10 +0200 Subject: [PATCH] tuple codegen --- parser/src/ast.rs | 1 + src/codegen.rs | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/parser/src/ast.rs b/parser/src/ast.rs index e98f654..0fb43d7 100644 --- a/parser/src/ast.rs +++ b/parser/src/ast.rs @@ -14,6 +14,7 @@ pub struct Block(pub Vec); #[derive(Debug, Clone, Serialize)] pub enum TypeExpr { Path(StaticPath), + Tuple(Vec), } #[derive(Debug, Clone, Serialize)] diff --git a/src/codegen.rs b/src/codegen.rs index dd69279..dca4fb5 100644 --- a/src/codegen.rs +++ b/src/codegen.rs @@ -76,6 +76,14 @@ impl GetRust for TypeExpr { fn get_rust(&self) -> String { match self { TypeExpr::Path(path) => get_static_type_path(path), + TypeExpr::Tuple(types) => format!( + "({})", + types + .iter() + .map(|t| t.get_rust()) + .collect::>() + .join(", ") + ), } } }