소스 검색

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;
+					}
 				}
 			}