mirror of
https://github.com/zeek/zeek.git
synced 2025-10-11 19:18:19 +00:00
parent
e22bf8ebb6
commit
8ede22f6ec
11 changed files with 76 additions and 10 deletions
13
src/Var.cc
13
src/Var.cc
|
@ -26,8 +26,7 @@
|
|||
namespace zeek::detail
|
||||
{
|
||||
|
||||
static bool add_prototype(const IDPtr& id, Type* t, std::vector<AttrPtr>* attrs,
|
||||
const ExprPtr& init)
|
||||
static bool add_prototype(const IDPtr& id, Type* t, std::vector<AttrPtr>* attrs)
|
||||
{
|
||||
if ( ! IsFunc(id->GetType()->Tag()) )
|
||||
return false;
|
||||
|
@ -53,12 +52,6 @@ static bool add_prototype(const IDPtr& id, Type* t, std::vector<AttrPtr>* attrs,
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( init )
|
||||
{
|
||||
init->Error("initialization not allowed during event/hook alternate prototype declaration");
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& canon_args = canon_ft->Params();
|
||||
const auto& alt_args = alt_ft->Params();
|
||||
|
||||
|
@ -221,8 +214,8 @@ static void make_var(const IDPtr& id, TypePtr t, InitClass c, ExprPtr init,
|
|||
|
||||
else if ( dt != VAR_REDEF || init || ! attr )
|
||||
{
|
||||
if ( IsFunc(id->GetType()->Tag()) )
|
||||
add_prototype(id, t.get(), attr.get(), init);
|
||||
if ( IsFunc(id->GetType()->Tag()) && ! init )
|
||||
add_prototype(id, t.get(), attr.get());
|
||||
else
|
||||
id->Error("already defined", init.get());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue