Преглед изворни кода

Fixed incorrectly allowed type mismatch on payload enum case

Brian Fiete пре 4 година
родитељ
комит
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;
+					}
 				}
 			}