diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 1ae39a2..4aff5be 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -149,10 +149,7 @@ impl Expression { }, _ => Expr::Val(name.clone()), }, - Call { f, arguments } => Expr::Call { - f: Box::new(f.node().reduce(symbol_table)), - args: arguments.iter().map(|arg| arg.node().reduce(symbol_table)).collect(), - }, + Call { f, arguments } => reduce_call_expression(f, arguments, symbol_table), TupleLiteral(exprs) => Expr::Tuple(exprs.iter().map(|e| e.node().reduce(symbol_table)).collect()), IfExpression { discriminator, body } => reduce_if_expression(discriminator, body, symbol_table), Lambda { params, body, .. } => reduce_lambda(params, body, symbol_table), @@ -173,6 +170,13 @@ fn reduce_lambda(params: &Vec, body: &Block, symbol_table: &SymbolT }) } +fn reduce_call_expression(func: &Meta, arguments: &Vec>, symbol_table: &SymbolTable) -> Expr { + Expr::Call { + f: Box::new(func.node().reduce(symbol_table)), + args: arguments.iter().map(|arg| arg.node().reduce(symbol_table)).collect(), + } +} + fn reduce_if_expression(discriminator: &Discriminator, body: &IfExpressionBody, symbol_table: &SymbolTable) -> Expr { let cond = Box::new(match *discriminator { Discriminator::Simple(ref expr) => expr.reduce(symbol_table),