mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Merge remote-tracking branch 'origin/topic/jsiwek/table-attribute-fixes'
* origin/topic/jsiwek/table-attribute-fixes: Fix various bugs with table/set attributes. Closes #866.
This commit is contained in:
commit
d9f90fcac0
8 changed files with 270 additions and 2 deletions
30
src/Var.cc
30
src/Var.cc
|
@ -109,6 +109,36 @@ static void make_var(ID* id, BroType* t, init_class c, Expr* init,
|
|||
if ( attr )
|
||||
id->AddAttrs(new Attributes(attr, t, false));
|
||||
|
||||
if ( init )
|
||||
{
|
||||
switch ( init->Tag() ) {
|
||||
case EXPR_TABLE_CONSTRUCTOR:
|
||||
{
|
||||
TableConstructorExpr* ctor = (TableConstructorExpr*) init;
|
||||
if ( ctor->Attrs() )
|
||||
{
|
||||
::Ref(ctor->Attrs());
|
||||
id->AddAttrs(ctor->Attrs());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case EXPR_SET_CONSTRUCTOR:
|
||||
{
|
||||
SetConstructorExpr* ctor = (SetConstructorExpr*) init;
|
||||
if ( ctor->Attrs() )
|
||||
{
|
||||
::Ref(ctor->Attrs());
|
||||
id->AddAttrs(ctor->Attrs());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( id->FindAttr(ATTR_PERSISTENT) || id->FindAttr(ATTR_SYNCHRONIZED) )
|
||||
{
|
||||
if ( dt == VAR_CONST )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue