diff --git a/schala-lang/language/src/reduced_ir/mod.rs b/schala-lang/language/src/reduced_ir/mod.rs index 7035052..b13da75 100644 --- a/schala-lang/language/src/reduced_ir/mod.rs +++ b/schala-lang/language/src/reduced_ir/mod.rs @@ -201,25 +201,18 @@ impl<'a> Reducer<'a> { rval: Box::new(self.expression(rhs)), } }, - Some(op) => { - Expression::Call { - f: Box::new(Expression::Callable(Function::Builtin(op))), - args: vec![self.expression(lhs), self.expression(rhs)], - } - } - None => { - //TODO handle a user-defined operation - ReductionError("User-defined operations not supported".to_string()) - } + Some(op) => Expression::Call { + f: Box::new(Expression::Callable(Function::Builtin(op))), + args: vec![self.expression(lhs), self.expression(rhs)], + }, + //TODO handle a user-defined operation + None => ReductionError("User-defined operations not supported".to_string()) } } fn value(&mut self, qualified_name: &ast::QualifiedName) -> Expression { use SymbolSpec::*; - let ast::QualifiedName { id: _, components, .. } = qualified_name; - let _ = components; - let symbol = match self.symbol_table.lookup_symbol(&qualified_name.id) { Some(s) => s, None => return Expression::ReductionError(format!("No symbol found for name: {:?}", qualified_name)) diff --git a/schala-lang/language/src/reduced_ir/types.rs b/schala-lang/language/src/reduced_ir/types.rs index 147e117..37af6b6 100644 --- a/schala-lang/language/src/reduced_ir/types.rs +++ b/schala-lang/language/src/reduced_ir/types.rs @@ -81,7 +81,12 @@ pub enum Function { Lambda { arity: u8, body: Vec - } + }, + DataConstructor { + type_id: Rc, //TODO this can't last + arity: u32, + tag: u32 + }, } #[derive(Debug, Clone)] diff --git a/schala-lang/language/src/tree_walk_eval/mod.rs b/schala-lang/language/src/tree_walk_eval/mod.rs index 200af03..a868b39 100644 --- a/schala-lang/language/src/tree_walk_eval/mod.rs +++ b/schala-lang/language/src/tree_walk_eval/mod.rs @@ -278,6 +278,7 @@ impl<'a> State<'a> { let body = body.clone(); //TODO again ideally, no cloning here self.apply_function(body, args) } + Function::DataConstructor { .. } => panic!(), } }