mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
Merge remote-tracking branch 'origin/topic/zeke/expire-func'
* origin/topic/zeke/expire-func: Ignore abs-path in test. Report argument # type check failed on. Update test baseline. Improve func arg type checking. &expire_func(table, arg1, arg2, ...) + type checking.
This commit is contained in:
commit
3159577821
8 changed files with 119 additions and 25 deletions
14
src/Type.cc
14
src/Type.cc
|
@ -587,13 +587,23 @@ int FuncType::CheckArgs(const type_list* args, bool is_init) const
|
|||
const type_list* my_args = arg_types->Types();
|
||||
|
||||
if ( my_args->length() != args->length() )
|
||||
{
|
||||
Warn(fmt("Wrong number of arguments for function. Expected %d, got %d.",
|
||||
args->length(), my_args->length()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int success = 1;
|
||||
|
||||
for ( int i = 0; i < my_args->length(); ++i )
|
||||
if ( ! same_type((*args)[i], (*my_args)[i], is_init) )
|
||||
return 0;
|
||||
{
|
||||
Warn(fmt("Type mismatch in function argument #%d. Expected %s, got %s.",
|
||||
i, type_name((*args)[i]->Tag()), type_name((*my_args)[i]->Tag())));
|
||||
success = 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
return success;
|
||||
}
|
||||
|
||||
void FuncType::Describe(ODesc* d) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue