add arg length check
This commit is contained in:
parent
99369b8f38
commit
fcd96c0efd
|
@ -11,6 +11,7 @@ fn make_pubid(id: &str) -> String {
|
|||
#[derive(Debug)]
|
||||
pub enum CompileErrorKind {
|
||||
UndefinedReference(String),
|
||||
BadArgCount{received: usize, expected: usize},
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -83,6 +84,12 @@ fn lower_expression(
|
|||
))
|
||||
})?;
|
||||
|
||||
if args_resolved.len() != callable.args.len() {
|
||||
return Err(CompileError::new(CompileErrorKind::BadArgCount{
|
||||
expected: callable.args.len(), received: args_resolved.len()
|
||||
}))
|
||||
}
|
||||
|
||||
let cell_id = module.make_genid(&callable.name);
|
||||
|
||||
let cell = (*callable.instantiate)(&cell_id, args_resolved.as_slice(), &output_gen_id);
|
||||
|
|
Loading…
Reference in New Issue