Make code more concise

This commit is contained in:
greg 2018-08-07 17:09:53 -07:00
parent 5ead1e5d44
commit f9c2fc3f9d
1 changed files with 8 additions and 10 deletions

View File

@ -116,8 +116,7 @@ impl Expression {
BoolLiteral(b) => Expr::Lit(Lit::Bool(*b)),
BinExp(binop, lhs, rhs) => binop.reduce(symbol_table, lhs, rhs),
PrefixExp(op, arg) => op.reduce(symbol_table, arg),
Value(name) => {
match symbol_table.lookup_by_name(name) {
Value(name) => match symbol_table.lookup_by_name(name) {
Some(Symbol { spec: SymbolSpec::DataConstructor { index, type_args, type_name}, .. }) => Expr::Constructor {
type_name: type_name.clone(),
name: name.clone(),
@ -125,7 +124,6 @@ impl Expression {
arity: type_args.len(),
},
_ => Expr::Val(name.clone()),
}
},
Call { f, arguments } => Expr::Call {
f: Box::new(f.reduce(symbol_table)),