mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Return an error if redef'ing a variable without redef attribute
This commit is contained in:
parent
86c316ddfc
commit
00e111135b
4 changed files with 39 additions and 0 deletions
|
@ -223,6 +223,12 @@ static void make_var(const IDPtr& id, TypePtr t, InitClass c, ExprPtr init,
|
|||
id->Warn("redefinition requires \"redef\"", redef_obj, true);
|
||||
}
|
||||
|
||||
else if ( dt == VAR_REDEF && ! id->IsRedefinable() )
|
||||
{
|
||||
id->Error("cannot redefine a variable not marked with &redef", init.get());
|
||||
return;
|
||||
}
|
||||
|
||||
else if ( dt != VAR_REDEF || init || ! attr )
|
||||
{
|
||||
if ( IsFunc(id->GetType()->Tag()) )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue