mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Added interpreter error for local event variables.
Scheduling a local event variable resulted in a global lookup instead of evaluating the local variable. To prevent misunderstandings, this will trigger an error now.
This commit is contained in:
parent
cc54b3772a
commit
65607239c9
5 changed files with 35 additions and 7 deletions
17
src/parse.y
17
src/parse.y
|
@ -1474,11 +1474,20 @@ event:
|
|||
TOK_ID '(' opt_expr_list ')'
|
||||
{
|
||||
set_location(@1, @4);
|
||||
$$ = new EventExpr($1, $3);
|
||||
ID* id = lookup_ID($1, current_module.c_str());
|
||||
|
||||
if ( id && id->IsDeprecated() )
|
||||
reporter->Warning("deprecated (%s)", id->Name());
|
||||
ID* id = lookup_ID($1, current_module.c_str());
|
||||
if ( id )
|
||||
{
|
||||
if ( ! id->IsGlobal() )
|
||||
{
|
||||
yyerror(fmt("local identifier \"%s\" cannot be used to reference an event", $1));
|
||||
YYERROR;
|
||||
}
|
||||
if ( id->IsDeprecated() )
|
||||
reporter->Warning("deprecated (%s)", id->Name());
|
||||
}
|
||||
|
||||
$$ = new EventExpr($1, $3);
|
||||
}
|
||||
;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue