Do not export locals

Fixes #4227
This commit is contained in:
Evan Typanski 2025-02-12 13:49:12 -08:00
parent b7b31ebce5
commit 7160e074f6
3 changed files with 28 additions and 1 deletions

View file

@ -2212,7 +2212,7 @@ local_id:
else else
{ {
$$ = install_ID($1, current_module.c_str(), $$ = install_ID($1, current_module.c_str(),
false, is_export).release(); false, false).release();
} }
} }
; ;

View file

@ -0,0 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
one
two

View file

@ -0,0 +1,24 @@
# @TEST-DOC: Ensure that locals are not hoisted to global scope.
# @TEST-EXEC: zeek -b %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER= btest-diff .stdout
module Test;
export {
function func1()
{
local t: string = "one";
print t;
}
function func2()
{
local t: string = "two";
print t;
}
}
event zeek_init()
{
func1();
func2();
}