mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed comptime reflected static field accesses
This commit is contained in:
parent
4176f7369d
commit
a356186514
7 changed files with 177 additions and 16 deletions
|
@ -481,6 +481,21 @@ namespace Tests
|
|||
}
|
||||
}
|
||||
|
||||
class ClassB
|
||||
{
|
||||
public static int mA = 123;
|
||||
}
|
||||
|
||||
class ClassC
|
||||
{
|
||||
[OnCompile(.TypeInit), Comptime]
|
||||
static void Init()
|
||||
{
|
||||
typeof(ClassB).GetField("mA").Value.GetValue<int>(null, var value);
|
||||
Compiler.EmitTypeBody(typeof(Self), scope $"public static int sA = {1000 + value};");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void TestBasics()
|
||||
{
|
||||
|
@ -499,6 +514,8 @@ namespace Tests
|
|||
Test.Assert(sa.mC == 345);
|
||||
Test.Assert(sa.GetValC() == 345);
|
||||
|
||||
Test.Assert(ClassC.sA == 1123);
|
||||
|
||||
Compiler.Mixin("int val = 99;");
|
||||
Test.Assert(val == 99);
|
||||
|
||||
|
@ -532,6 +549,8 @@ namespace Tests
|
|||
Test.Assert(typeof(decltype(f)) == typeof(float));
|
||||
Test.Assert(ClassB<const 3>.cTimesTen == 30);
|
||||
|
||||
|
||||
|
||||
DictWrapper<Dictionary<int, float>> dictWrap = scope .();
|
||||
dictWrap.[Friend]mValue.Add(1, 2.3f);
|
||||
dictWrap.[Friend]mValue.Add(2, 3.4f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue