1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 20:42:21 +02:00

Fixed comptime static local variables

This commit is contained in:
Brian Fiete 2025-03-13 08:08:44 -04:00
parent 11ccb876a3
commit 17ca23c9af
3 changed files with 82 additions and 26 deletions

View file

@ -573,6 +573,20 @@ namespace Tests
}
}
public static int GetLocalVal1()
{
static int sVal = 100;
sVal++;
return sVal;
}
[Comptime]
public static int GetLocalVal2()
{
GetLocalVal1();
return GetLocalVal1();
}
[Test]
public static void TestBasics()
{
@ -666,6 +680,9 @@ namespace Tests
const int typeSizes = StructE.GetSizes();
Test.Assert(typeSizes == sizeof(StructA) + sizeof(EnumA));
const int cVal = GetLocalVal2();
Test.Assert(cVal == 102);
}
}
}