fix case for 0 arg function calls

Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
Ava Hahn 2023-01-22 19:36:37 -08:00
parent e7dd0caa4a
commit 71b70fe4b8
Signed by untrusted user who does not match committer: affine
GPG key ID: 3A4645B8CF806069
4 changed files with 29 additions and 22 deletions

View file

@ -101,7 +101,16 @@ pub fn func_call(
match &called_func.args {
Args::Lazy(num) => {
let called_arg_count = list_len(n_args.clone()) as i128;
if *num > -1 && (*num != called_arg_count) {
if *num == 0 {
if let Ctr::None = n_args.clone().borrow().car {
//pass
} else {
return Err(format!(
"expected 0 args in call to {}. Got one or more.",
called_func.name,
));
}
} else if *num > -1 && (*num != called_arg_count) {
return Err(format!(
"expected {} args in call to {}. Got {}.",
num, called_func.name, called_arg_count