mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 18:48:20 +00:00
Improve func arg type checking.
This commit is contained in:
parent
0ca6b3e013
commit
8a451a24e3
1 changed files with 5 additions and 1 deletions
|
@ -592,14 +592,18 @@ int FuncType::CheckArgs(const type_list* args, bool is_init) const
|
||||||
args->length(), my_args->length()));
|
args->length(), my_args->length()));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int had_error = 1;
|
||||||
|
|
||||||
for ( int i = 0; i < my_args->length(); ++i )
|
for ( int i = 0; i < my_args->length(); ++i )
|
||||||
if ( ! same_type((*args)[i], (*my_args)[i], is_init) )
|
if ( ! same_type((*args)[i], (*my_args)[i], is_init) )
|
||||||
{
|
{
|
||||||
Warn(fmt("Type mismatch in function arguments. Expected %s, got %s.",
|
Warn(fmt("Type mismatch in function arguments. Expected %s, got %s.",
|
||||||
type_name((*args)[i]->Tag()), type_name((*my_args)[i]->Tag())));
|
type_name((*args)[i]->Tag()), type_name((*my_args)[i]->Tag())));
|
||||||
|
had_error = 0; // continue checking types, don't return.
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return had_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FuncType::Describe(ODesc* d) const
|
void FuncType::Describe(ODesc* d) const
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue