mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed for discriminated unions with attempted initializers
This commit is contained in:
parent
fd3265445d
commit
2192305800
1 changed files with 8 additions and 2 deletions
|
@ -3659,8 +3659,8 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance*
|
||||||
Fail("Const requires initializer", fieldDef->mFieldDeclaration->mNameNode);
|
Fail("Const requires initializer", fieldDef->mFieldDeclaration->mNameNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (mBfIRBuilder != NULL)
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(mCurTypeInstance, typeInstance);
|
SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(mCurTypeInstance, typeInstance);
|
||||||
|
|
||||||
SetAndRestoreValue<bool> prevIgnoreWrite(mBfIRBuilder->mIgnoreWrites, true);
|
SetAndRestoreValue<bool> prevIgnoreWrite(mBfIRBuilder->mIgnoreWrites, true);
|
||||||
|
@ -3692,6 +3692,12 @@ void BfModule::ResolveConstField(BfTypeInstance* typeInstance, BfFieldInstance*
|
||||||
constValue = uncastedInitValue.mValue;
|
constValue = uncastedInitValue.mValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((mCurTypeInstance->IsPayloadEnum()) && (fieldDef->IsEnumCaseEntry()))
|
||||||
|
{
|
||||||
|
// Illegal
|
||||||
|
constValue = BfIRValue();
|
||||||
|
}
|
||||||
|
|
||||||
mBfIRBuilder->SetInsertPoint(prevInsertBlock);
|
mBfIRBuilder->SetInsertPoint(prevInsertBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue