1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-07-05 07:45:59 +02:00

'var' fixes

This commit is contained in:
Brian Fiete 2020-04-16 00:30:55 -07:00
parent 37e5576973
commit 75e0cb9907

View file

@ -3924,7 +3924,7 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
bool tryExtendValue = false; bool tryExtendValue = false;
bool addDebugInfo = true; bool addDebugInfo = true;
if ((wantsDebugInfo) && (!switchValue.mType->IsValuelessType())) if ((wantsDebugInfo) && (!switchValue.mType->IsValuelessType()) && (!switchValue.mType->IsVar()))
{ {
if (IsTargetingBeefBackend()) if (IsTargetingBeefBackend())
{ {
@ -4000,6 +4000,7 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
} }
} }
if (!localDef->mResolvedType->IsVar())
AddLocalVariableDef(localDef, addDebugInfo, true); AddLocalVariableDef(localDef, addDebugInfo, true);
BfDeferredLocalAssignData deferredLocalAssignData(mCurMethodState->mCurScope); BfDeferredLocalAssignData deferredLocalAssignData(mCurMethodState->mCurScope);
@ -4062,7 +4063,7 @@ void BfModule::Visit(BfSwitchStatement* switchStmt)
enumTagVal = LoadValue(enumTagVal); enumTagVal = LoadValue(enumTagVal);
switchStatement = mBfIRBuilder->CreateSwitch(enumTagVal.mValue, noSwitchBlock, numExpressions); switchStatement = mBfIRBuilder->CreateSwitch(enumTagVal.mValue, noSwitchBlock, numExpressions);
} }
else if (!isConstSwitch) else if ((!isConstSwitch) && (!switchValue.mType->IsVar()))
switchStatement = mBfIRBuilder->CreateSwitch(switchValue.mValue, noSwitchBlock, numExpressions); switchStatement = mBfIRBuilder->CreateSwitch(switchValue.mValue, noSwitchBlock, numExpressions);
} }