From 121e5b9b060e8f1327830c6180ed71c4517b4d10 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 15 May 2020 15:42:44 -0700 Subject: [PATCH] Added type enumeration --- BeefLibs/corlib/src/Type.bf | 26 ++++++++++++++++++++++++++ IDE/BeefProj.toml | 2 +- IDEHelper/IDEHelper.vcxproj.user | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/BeefLibs/corlib/src/Type.bf b/BeefLibs/corlib/src/Type.bf index 8536846e..31a6ba04 100644 --- a/BeefLibs/corlib/src/Type.bf +++ b/BeefLibs/corlib/src/Type.bf @@ -35,6 +35,14 @@ namespace System } } + public static Enumerator Types + { + get + { + return .(); + } + } + public int32 Size { get @@ -461,6 +469,24 @@ namespace System { return FieldInfo.Enumerator(null, bindingFlags); } + + public struct Enumerator : IEnumerator + { + int32 mCurId; + + public Result GetNext() mut + { + while (true) + { + if (mCurId >= sTypeCount) + return .Err; + let type = sTypes[mCurId++]; + if (type != null) + return .Ok(type); + } + } + } + } enum TypeCode : uint8 diff --git a/IDE/BeefProj.toml b/IDE/BeefProj.toml index 176ccf26..5594b8be 100644 --- a/IDE/BeefProj.toml +++ b/IDE/BeefProj.toml @@ -48,7 +48,7 @@ OtherLinkFlags = "" TargetDirectory = "$(WorkspaceDir)/dist" TargetName = "BeefIDE_d2" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib BeefySysLib64_d.lib wsock32.lib" -DebugCommandArguments = "-workspace=C:\\Beef\\IDEHelper\\Tests" +DebugCommandArguments = "-workspace=C:\\Beef\\IDE\\mintest" DebugWorkingDirectory = "$(ProjectDir)\\dist" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] diff --git a/IDEHelper/IDEHelper.vcxproj.user b/IDEHelper/IDEHelper.vcxproj.user index ecb3bb9c..c0a7a016 100644 --- a/IDEHelper/IDEHelper.vcxproj.user +++ b/IDEHelper/IDEHelper.vcxproj.user @@ -20,6 +20,6 @@ _NO_DEBUG_HEAP=1 - false + true \ No newline at end of file