Validate unified source and native positional call contracts
This commit is contained in:
@@ -260,6 +260,16 @@ impl Vm {
|
||||
for argument in arguments {
|
||||
self.validate_value(argument)?;
|
||||
}
|
||||
if let Some(arity) = self.objects.call_arity(function)?
|
||||
&& !arity.accepts(arguments.len())
|
||||
{
|
||||
return Err(VmError::ArgumentCount {
|
||||
name: self.object(function)?.payload().kind_name().into(),
|
||||
required: arity.required,
|
||||
maximum: arity.maximum,
|
||||
provided: arguments.len(),
|
||||
});
|
||||
}
|
||||
if let Some(callable) = self.object(function)?.payload().native_callable() {
|
||||
return NativeContext::execute(&mut self.objects, function, arguments, callable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user