1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-16 23:34:10 +02:00

Improved variable assignment detection in local methods

This commit is contained in:
Brian Fiete 2022-07-30 17:12:52 -04:00
parent d43c47f866
commit 3739020504
2 changed files with 29 additions and 14 deletions

View file

@ -347,22 +347,29 @@ namespace Tests
public static void TestL()
{
int a = 8;
int b;
int LocalA()
if (a == 8)
{
return 9;
b = 9;
int LocalA()
{
return 9;
}
int LocalB()
{
int q = b;
return a;
}
function int() func = => LocalA;
Test.Assert(func() == 9);
delegate int() dlg = scope => LocalB;
Test.Assert(dlg() == 8);
}
int LocalB()
{
return a;
}
function int() func = => LocalA;
Test.Assert(func() == 9);
delegate int() dlg = scope => LocalB;
Test.Assert(dlg() == 8);
}
}
}