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:
parent
d43c47f866
commit
3739020504
2 changed files with 29 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue