mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Fixed field initialization in structs with extensions
This commit is contained in:
parent
8be5d70c27
commit
994640df11
1 changed files with 6 additions and 2 deletions
|
@ -15556,7 +15556,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
||||||
|
|
||||||
calledCtorNoBody = true;
|
calledCtorNoBody = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize fields (if applicable)
|
// Initialize fields (if applicable)
|
||||||
|
@ -15568,7 +15568,7 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
||||||
{
|
{
|
||||||
// Field initializers occur in CtorNoBody methods for extensions
|
// Field initializers occur in CtorNoBody methods for extensions
|
||||||
}
|
}
|
||||||
else if ((!hadThisInitializer) && (!calledCtorNoBody))
|
else if (!hadThisInitializer)
|
||||||
{
|
{
|
||||||
// If we had a 'this' initializer, that other ctor will have initialized our fields
|
// If we had a 'this' initializer, that other ctor will have initialized our fields
|
||||||
|
|
||||||
|
@ -15578,6 +15578,10 @@ void BfModule::EmitCtorBody(bool& skipBody)
|
||||||
(mCompiler->mResolvePassData->mAutoComplete == NULL) ||
|
(mCompiler->mResolvePassData->mAutoComplete == NULL) ||
|
||||||
(mCompiler->mResolvePassData->mAutoComplete->mResolveType == BfResolveType_ShowFileSymbolReferences))
|
(mCompiler->mResolvePassData->mAutoComplete->mResolveType == BfResolveType_ShowFileSymbolReferences))
|
||||||
{
|
{
|
||||||
|
// If we calledCtorNoBody then we did the field initializer code, but we still need to run though it here
|
||||||
|
// to properly set the assigned flags
|
||||||
|
SetAndRestoreValue<bool> prevIgnoreWrites(mBfIRBuilder->mIgnoreWrites, mBfIRBuilder->mIgnoreWrites || calledCtorNoBody);
|
||||||
|
|
||||||
bool hadInlineInitBlock = false;
|
bool hadInlineInitBlock = false;
|
||||||
BfScopeData scopeData;
|
BfScopeData scopeData;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue