Explorar el Código

Fixed invalid enum const type finalization with non-enum-case const

Brian Fiete hace 4 años
padre
commit
1efd403472
Se han modificado 1 ficheros con 7 adiciones y 6 borrados
  1. 7 6
      IDEHelper/Compiler/BfModuleTypeUtils.cpp

+ 7 - 6
IDEHelper/Compiler/BfModuleTypeUtils.cpp

@@ -3800,12 +3800,13 @@ void BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
 				for (auto& fieldInstanceRef : typeInstance->mFieldInstances)
 				{
 					auto fieldInstance = &fieldInstanceRef;
-					if (fieldInstance->mConstIdx != -1)
-					{
-						auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
-						BfIRValue newConstant = typeInstance->mConstHolder->CreateConst(typeCode, constant->mUInt64);
-						fieldInstance->mConstIdx = newConstant.mId;
-					}
+					if (fieldInstance->mConstIdx == -1)
+						continue;
+					if (!fieldInstance->GetFieldDef()->IsEnumCaseEntry())
+						continue;
+					auto constant = typeInstance->mConstHolder->GetConstantById(fieldInstance->mConstIdx);
+					BfIRValue newConstant = typeInstance->mConstHolder->CreateConst(typeCode, constant->mUInt64);
+					fieldInstance->mConstIdx = newConstant.mId;					
 				}
 			}