From bc6d4d19b5f2b02bb3a19826553224966bcfd967 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 25 Jul 2018 03:05:40 -0700 Subject: [PATCH] reduced ast match --- schala-lang/src/reduced_ast.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/schala-lang/src/reduced_ast.rs b/schala-lang/src/reduced_ast.rs index 52c096d..58cbb13 100644 --- a/schala-lang/src/reduced_ast.rs +++ b/schala-lang/src/reduced_ast.rs @@ -142,9 +142,15 @@ fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, None => vec![], Some(stmts) => stmts.iter().map(|expr| expr.reduce(symbol_table)).collect(), }; - Expr::Conditional { cond, then_clause, else_clause } + Expr::Match { + cond, + arms: vec![ + (pat.clone(), then_clause), + (Pattern::Ignored, else_clause) + ], + } }, - _ => panic!(), + IfExpressionBody::GuardList(ref _guard_arms) => panic!(), } }