fix function calls with no argument
This commit is contained in:
parent
ee3b53bfb5
commit
d8eef9c95b
1 changed files with 16 additions and 8 deletions
12
src/eval.rs
12
src/eval.rs
|
|
@ -46,14 +46,22 @@ pub fn eval(
|
|||
|
||||
// another check to detect if we may have a function call
|
||||
if let Ctr::Symbol(ref tok) = car {
|
||||
if let Ctr::Seg(ast) = cdr {
|
||||
match cdr {
|
||||
Ctr::Seg(ast) => {
|
||||
if let Some(func) = funcs.borrow().get(tok) {
|
||||
return func_call(func.clone(), ast.clone(), vars.clone(), funcs.clone())
|
||||
} else {
|
||||
return Err(format!("Couldnt find function: {}.", tok))
|
||||
}
|
||||
},
|
||||
Ctr::None => {
|
||||
if let Some(func) = funcs.borrow().get(tok) {
|
||||
return func_call(func.clone(), new_ast(Ctr::None, Ctr::None), vars.clone(), funcs.clone())
|
||||
} else {
|
||||
return Err(format!("Arguments to function not a list!"))
|
||||
return Err(format!("Couldnt find function: {}.", tok))
|
||||
}
|
||||
},
|
||||
_ => return Err(format!("Arguments to function not a list!"))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue