mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 10:08:20 +00:00
Fixing attributes to allow &default in tables/sets to be associated
with the field. This works now: type X: record { a: table[string] of bool &default=table( ["foo"] = T ); b: table[string] of bool &default=table(); c: set[string] &default=set("A", "B", "C"); d: set[string] &default=set(); }; I think previously the intend was to associate &default with the table/set (i.e., define the default value for non-existing indices). However, that was already not working: the error checking was reporting type mismatches. So, this shouldn't break anything and make things more consistent.
This commit is contained in:
parent
68a30a0b5a
commit
0a97a9e82a
10 changed files with 72 additions and 24 deletions
|
@ -107,7 +107,7 @@ static void make_var(ID* id, BroType* t, init_class c, Expr* init,
|
|||
id->SetType(t);
|
||||
|
||||
if ( attr )
|
||||
id->AddAttrs(new Attributes(attr, t));
|
||||
id->AddAttrs(new Attributes(attr, t, false));
|
||||
|
||||
if ( id->FindAttr(ATTR_PERSISTENT) || id->FindAttr(ATTR_SYNCHRONIZED) )
|
||||
{
|
||||
|
@ -221,7 +221,7 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
|
|||
id->MakeType();
|
||||
|
||||
if ( attr )
|
||||
id->SetAttrs(new Attributes(attr, t));
|
||||
id->SetAttrs(new Attributes(attr, t, false));
|
||||
}
|
||||
|
||||
void begin_func(ID* id, const char* module_name, function_flavor flavor,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue