mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 02:28:21 +00:00
fix bug that sometimes associated the wrong location with global statements
This commit is contained in:
parent
f25aded984
commit
5a32e58e04
1 changed files with 13 additions and 3 deletions
16
src/parse.y
16
src/parse.y
|
@ -317,12 +317,22 @@ static StmtPtr build_local(ID* id, Type* t, InitClass ic, Expr* e,
|
|||
%%
|
||||
|
||||
zeek:
|
||||
decl_list stmt_list
|
||||
decl_list
|
||||
{
|
||||
// Without the following, in some scenarios the
|
||||
// location associated with global statements gets
|
||||
// associated with the last @load'd file rather than
|
||||
// the script that includes the global statements.
|
||||
auto loc = zeek::detail::GetCurrentLocation();
|
||||
if ( loc.filename )
|
||||
set_location(loc);
|
||||
}
|
||||
stmt_list
|
||||
{
|
||||
if ( stmts )
|
||||
stmts->AsStmtList()->Stmts().push_back($2);
|
||||
stmts->AsStmtList()->Stmts().push_back($3);
|
||||
else
|
||||
stmts = $2;
|
||||
stmts = $3;
|
||||
|
||||
// Any objects creates from here on out should not
|
||||
// have file positions associated with them.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue