浏览代码

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