Просмотр исходного кода

Fixed enum ToString when it contains other const fields

Brian Fiete 4 лет назад
Родитель
Сommit
f3c17a671c
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      IDEHelper/Compiler/BfModule.cpp

+ 5 - 0
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))
 		{