From 56f0f3e4f22cf6997bfc1dc3a302f2284ef168a4 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sun, 13 Feb 2022 08:24:15 -0500 Subject: [PATCH] Fixed exhaustive switch check on payload enums with static members --- IDEHelper/Compiler/BfStmtEvaluator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IDEHelper/Compiler/BfStmtEvaluator.cpp b/IDEHelper/Compiler/BfStmtEvaluator.cpp index b5bd1e69..99bb1a14 100644 --- a/IDEHelper/Compiler/BfStmtEvaluator.cpp +++ b/IDEHelper/Compiler/BfStmtEvaluator.cpp @@ -4850,6 +4850,8 @@ void BfModule::Visit(BfSwitchStatement* switchStmt) auto fieldDef = field.GetFieldDef(); if (fieldDef == NULL) continue; + if (!fieldDef->IsEnumCaseEntry()) + continue; if (field.mDataIdx < 0) lastTagId = -field.mDataIdx - 1; } @@ -4860,7 +4862,7 @@ void BfModule::Visit(BfSwitchStatement* switchStmt) for (auto& field : enumType->mFieldInstances) { auto fieldDef = field.GetFieldDef(); - if ((fieldDef != NULL) && (fieldDef->mFieldDeclaration != NULL) && (fieldDef->mFieldDeclaration->mTypeRef == NULL)) + if ((fieldDef != NULL) && (fieldDef->IsEnumCaseEntry())) { if (field.mConstIdx != -1) {