mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
&expire_func(table, arg1, arg2, ...) + type checking.
This commit is contained in:
parent
c22edc28a5
commit
0ca6b3e013
5 changed files with 110 additions and 25 deletions
10
src/Type.cc
10
src/Type.cc
|
@ -587,11 +587,17 @@ 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;
|
||||
|
||||
}
|
||||
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 arguments. Expected %s, got %s.",
|
||||
type_name((*args)[i]->Tag()), type_name((*my_args)[i]->Tag())));
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue