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

Fixed incorrectly allowed type mismatch on payload enum case

Brian Fiete 4 лет назад
Родитель
Сommit
49c2a69a45
1 измененных файлов с 6 добавлено и 3 удалено
  1. 6 3
      IDEHelper/Compiler/BfStmtEvaluator.cpp

+ 6 - 3
IDEHelper/Compiler/BfStmtEvaluator.cpp

@@ -4464,9 +4464,12 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
 						}
 					}
 
-					constantInt = mBfIRBuilder->GetConstant(caseValue.mValue);
-					if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode)))
-						constantInt = NULL;
+					if (caseValue.mType == switchValue.mType)
+					{
+						constantInt = mBfIRBuilder->GetConstant(caseValue.mValue);
+						if ((constantInt != NULL) && (!mBfIRBuilder->IsInt(constantInt->mTypeCode)))
+							constantInt = NULL;
+					}
 				}
 			}