GH-157: Mark some attributes as not allowed for global variables

This commit is contained in:
Tim Wojtulewicz 2019-07-08 14:31:51 -07:00
parent a2c7ed5ff6
commit ec4913ac18
8 changed files with 41 additions and 17 deletions

View file

@ -108,7 +108,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, false));
id->AddAttrs(new Attributes(attr, t, false, id->IsGlobal()));
if ( init )
{
@ -286,7 +286,7 @@ void add_type(ID* id, BroType* t, attr_list* attr)
id->MakeType();
if ( attr )
id->SetAttrs(new Attributes(attr, tnew, false));
id->SetAttrs(new Attributes(attr, tnew, false, false));
}
static void transfer_arg_defaults(RecordType* args, RecordType* recv)
@ -304,7 +304,7 @@ static void transfer_arg_defaults(RecordType* args, RecordType* recv)
if ( ! recv_i->attrs )
{
attr_list* a = new attr_list{def};
recv_i->attrs = new Attributes(a, recv_i->type, true);
recv_i->attrs = new Attributes(a, recv_i->type, true, false);
}
else if ( ! recv_i->attrs->FindAttr(ATTR_DEFAULT) )