1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-04 23:36:00 +02:00

Improved variable assignment detection

This commit is contained in:
Brian Fiete 2022-07-05 08:04:38 -07:00
parent a42e0fad60
commit 5277797d73
5 changed files with 206 additions and 55 deletions

View file

@ -342,5 +342,79 @@ namespace IDETest
int b3 = b; //FAIL
int c3 = c; //FAIL
}
Result<int> Read()
{
return 0;
}
public void Local8()
{
int read;
loop: repeat
{
switch (Read())
{
case .Err: return;
case .Ok(let val): read = val;
}
}
while (read > 0);
}
public void Local9()
{
int read;
loop: repeat
{
switch (Read())
{
case .Err: break loop;
case .Ok(let val): read = val;
}
int a = read;
}
while (read > 0);
}
public void Local10()
{
int read;
loop: repeat
{
switch (Read())
{
case .Err: break;
case .Ok(let val): read = val;
}
int a = read; //FAIL
}
while (read > 0); //FAIL
}
public void Local11()
{
int a = 123;
int read;
Loop: repeat
{
break;
}
while (read > 0);
}
public void Local12()
{
int a = 123;
int read;
Loop: repeat
{
if (a == 123)
break;
}
while (read > 0); //FAIL
}
}
}