From f3c17a671cbf72a44d3f7904062e1ec99948b3f6 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Thu, 25 Feb 2021 06:07:31 -0800 Subject: [PATCH] Fixed enum ToString when it contains other const fields --- IDEHelper/Compiler/BfModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 513a8f88..563214ca 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -16867,6 +16867,11 @@ void BfModule::EmitEnumToStringBody() if (fieldInstance.mConstIdx == -1) continue; + // Only allow compact 'ValA, ValB' enum declaration fields through + auto fieldDecl = fieldInstance.GetFieldDef()->mFieldDeclaration; + if ((fieldDecl == NULL) || (fieldDecl->mTypeRef != NULL)) + continue; + auto constant = mCurTypeInstance->mConstHolder->GetConstantById(fieldInstance.mConstIdx); if (!handledCases.TryAdd(constant->mInt64, NULL)) {