|
|
|
@ -181,6 +181,8 @@ pub fn compile_fun<I: Iterator<Item = Ast>>(
|
|
|
|
|
let mut name_it = name.into_iter();
|
|
|
|
|
let name = expect_symbol(name_it.next(), &name_loc)?;
|
|
|
|
|
expect_empty(name_it, name_loc)?;
|
|
|
|
|
let _return_type = expect_one_of(&[":void"], expect_symbol(list.next(), &loc)?)?;
|
|
|
|
|
let return_type = _return_type.into_inner().replace(":", "");
|
|
|
|
|
let body = list.collect::<Vec<_>>();
|
|
|
|
|
let location = if let (Some(s), Some(e)) = (
|
|
|
|
|
body.first().map(|a| a.location()),
|
|
|
|
@ -192,7 +194,7 @@ pub fn compile_fun<I: Iterator<Item = Ast>>(
|
|
|
|
|
};
|
|
|
|
|
let fun = Function {
|
|
|
|
|
name: name.to_string(),
|
|
|
|
|
return_type: "void".to_string(),
|
|
|
|
|
return_type: return_type,
|
|
|
|
|
arguments: vec![],
|
|
|
|
|
body: Some(vec![]),
|
|
|
|
|
ast: Some(Ast::List(Localised {
|
|
|
|
|