More boilerplate for apply

This commit is contained in:
greg 2019-02-23 03:55:46 -08:00
parent 0e9b3229e9
commit 5bac01cf20

View File

@ -337,12 +337,15 @@ impl<'a> TypeContext<'a> {
println!("ARGUMENT TYPES: {:?}", argument_types); println!("ARGUMENT TYPES: {:?}", argument_types);
//TODO finish this
Ok(ty!(UserDefined)) Ok(ty!(UserDefined))
} }
fn call(&mut self, f: &Expression, args: &Vec<Meta<Expression>>) -> InferResult<Type> { fn call(&mut self, f: &Expression, args: &Vec<Meta<Expression>>) -> InferResult<Type> {
let tf = self.expr(f)?;
Ok(ty!(UserDefined)) let arg_types: InferResult<Vec<Type>> = args.iter().map(|ex| self.expr(ex.node())).collect();
let arg_types = arg_types?;
self.handle_apply(tf, arg_types)
} }
fn handle_apply(&mut self, tf: Type, args: Vec<Type>) -> InferResult<Type> { fn handle_apply(&mut self, tf: Type, args: Vec<Type>) -> InferResult<Type> {