Make type for DataConstructor
This commit is contained in:
parent
b00df64f55
commit
e18ddbded9
@ -201,25 +201,18 @@ impl<'a> Reducer<'a> {
|
|||||||
rval: Box::new(self.expression(rhs)),
|
rval: Box::new(self.expression(rhs)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(op) => {
|
Some(op) => Expression::Call {
|
||||||
Expression::Call {
|
|
||||||
f: Box::new(Expression::Callable(Function::Builtin(op))),
|
f: Box::new(Expression::Callable(Function::Builtin(op))),
|
||||||
args: vec![self.expression(lhs), self.expression(rhs)],
|
args: vec![self.expression(lhs), self.expression(rhs)],
|
||||||
}
|
},
|
||||||
}
|
|
||||||
None => {
|
|
||||||
//TODO handle a user-defined operation
|
//TODO handle a user-defined operation
|
||||||
ReductionError("User-defined operations not supported".to_string())
|
None => ReductionError("User-defined operations not supported".to_string())
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn value(&mut self, qualified_name: &ast::QualifiedName) -> Expression {
|
fn value(&mut self, qualified_name: &ast::QualifiedName) -> Expression {
|
||||||
use SymbolSpec::*;
|
use SymbolSpec::*;
|
||||||
|
|
||||||
let ast::QualifiedName { id: _, components, .. } = qualified_name;
|
|
||||||
let _ = components;
|
|
||||||
|
|
||||||
let symbol = match self.symbol_table.lookup_symbol(&qualified_name.id) {
|
let symbol = match self.symbol_table.lookup_symbol(&qualified_name.id) {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
None => return Expression::ReductionError(format!("No symbol found for name: {:?}", qualified_name))
|
None => return Expression::ReductionError(format!("No symbol found for name: {:?}", qualified_name))
|
||||||
|
@ -81,7 +81,12 @@ pub enum Function {
|
|||||||
Lambda {
|
Lambda {
|
||||||
arity: u8,
|
arity: u8,
|
||||||
body: Vec<Statement>
|
body: Vec<Statement>
|
||||||
}
|
},
|
||||||
|
DataConstructor {
|
||||||
|
type_id: Rc<String>, //TODO this can't last
|
||||||
|
arity: u32,
|
||||||
|
tag: u32
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -278,6 +278,7 @@ impl<'a> State<'a> {
|
|||||||
let body = body.clone(); //TODO again ideally, no cloning here
|
let body = body.clone(); //TODO again ideally, no cloning here
|
||||||
self.apply_function(body, args)
|
self.apply_function(body, args)
|
||||||
}
|
}
|
||||||
|
Function::DataConstructor { .. } => panic!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user