1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-12 13:24:09 +02:00

Changed Count/MinValue/MaxValue from properties to methods

This commit is contained in:
Brian Fiete 2022-06-23 13:37:15 -07:00
parent d17da427bc
commit 439b34f7c2
2 changed files with 35 additions and 44 deletions

View file

@ -4,11 +4,9 @@ using System.Collections;
namespace System namespace System
{ {
struct Enum struct Enum
{
public static int Count
{ {
[Comptime(ConstEval=true)] [Comptime(ConstEval=true)]
get public static int GetCount()
{ {
int count = 0; int count = 0;
for (var field in Compiler.OrigCalleeType.GetFields()) for (var field in Compiler.OrigCalleeType.GetFields())
@ -18,12 +16,9 @@ namespace System
} }
return count; return count;
} }
}
public static var MinValue
{
[Comptime(ConstEval=true)] [Comptime(ConstEval=true)]
get public static var GetMinValue()
{ {
Compiler.SetReturnType(Compiler.OrigCalleeType); Compiler.SetReturnType(Compiler.OrigCalleeType);
@ -40,12 +35,9 @@ namespace System
} }
return minValue.ValueOrDefault; return minValue.ValueOrDefault;
} }
}
public static var MaxValue
{
[Comptime(ConstEval=true)] [Comptime(ConstEval=true)]
get public static var GetMaxValue()
{ {
Compiler.SetReturnType(Compiler.OrigCalleeType); Compiler.SetReturnType(Compiler.OrigCalleeType);
@ -64,7 +56,6 @@ namespace System
return -1; return -1;
return maxValue.ValueOrDefault; return maxValue.ValueOrDefault;
} }
}
public static void EnumToString(Type type, String strBuffer, int64 iVal) public static void EnumToString(Type type, String strBuffer, int64 iVal)
{ {

View file

@ -138,9 +138,9 @@ namespace Tests
eg.Set(66); eg.Set(66);
Test.Assert(eg == .B); Test.Assert(eg == .B);
var ea = EnumA.MaxValue; var ea = EnumA.GetMaxValue();
Test.Assert(ea == .B); Test.Assert(ea == .B);
Test.Assert(EnumA.Count == 2); Test.Assert(EnumA.GetCount() == 2);
} }
} }
} }