diff --git a/schala-lang/src/eval.rs b/schala-lang/src/eval.rs index f7ad42c..30557a1 100644 --- a/schala-lang/src/eval.rs +++ b/schala-lang/src/eval.rs @@ -77,7 +77,9 @@ impl Expr { UserDefined { name: None, .. } => format!(""), UserDefined { name: Some(name), .. } => format!("", name), }, - Expr::Constructor { name } => format!("", name), + Expr::NewConstructor { + type_name, tag, arity, + } => unimplemented!(), Expr::Tuple(exprs) => paren_wrapped_vec(exprs), _ => format!("{:?}", self), } diff --git a/schala-lang/src/reduced_ast.rs b/schala-lang/src/reduced_ast.rs index 7523807..9c355cf 100644 --- a/schala-lang/src/reduced_ast.rs +++ b/schala-lang/src/reduced_ast.rs @@ -32,7 +32,7 @@ pub enum Expr { NewConstructor { type_name: Rc, tag: usize, - arg: Box, + arity: usize, }, Constructor { name: Rc, @@ -117,8 +117,10 @@ impl Expression { PrefixExp(op, arg) => op.reduce(symbol_table, arg), Value(name) => { match symbol_table.values.get(name) { - Some(Symbol { spec: SymbolSpec::DataConstructor { type_args, .. }, .. }) => { - Expr::Constructor { name: name.clone() } + Some(Symbol { spec: SymbolSpec::DataConstructor { index, type_args, type_name}, .. }) => Expr::NewConstructor { + type_name: type_name.clone(), + tag: index.clone(), + arity: type_args.len(), }, _ => Expr::Val(name.clone()), }