diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 12613d7..99f80c3 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -63,6 +63,12 @@ pub struct Alternative { pub item: Vec, } +impl Alternative { + fn default(item: Vec) -> Alternative { + Alternative { tag: None, guard: None, bound_vars: vec![], item } + } +} + #[derive(Debug, Clone)] pub enum Lit { Nat(u64), @@ -156,12 +162,7 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, let alternatives = vec![ pat.to_alternative(&cond, then_clause, symbol_table), - Alternative { - tag: None, - guard: None, - bound_vars: vec![], - item: else_clause, - }, + Alternative::default(else_clause), ]; Expr::CaseMatch { @@ -217,7 +218,7 @@ impl Pattern { Record(_name, _pairs) => { unimplemented!() }, - Ignored => unimplemented!(), + Ignored => Alternative::default(item), Literal(lit) => match lit { PatternLiteral::NumPattern { neg, num } => { let comparison = Expr::Lit(match (neg, num) {