1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed some issues with types with extensions and emitted methods

This commit is contained in:
Brian Fiete 2022-06-27 12:19:24 -07:00
parent d6af5b826f
commit f7efa3466a
4 changed files with 28 additions and 9 deletions

View file

@ -2352,11 +2352,6 @@ void BfModule::UpdateCEEmit(CeEmitContext* ceEmitContext, BfTypeInstance* typeIn
defBuilder.mCurTypeDef = typeInstance->mTypeDef;
defBuilder.mCurDeclaringTypeDef = typeInstance->mTypeDef;
if (typeInstance->mTypeDef->mIsCombinedPartial)
{
// Always define generated methods on the primary type declaration
defBuilder.mCurDeclaringTypeDef = typeInstance->mTypeDef->mPartials[0]->GetLatest();
}
defBuilder.mPassInstance = mCompiler->mPassInstance;
defBuilder.mIsComptime = true;
defBuilder.DoVisitChild(typeDeclaration->mDefineNode);
@ -9676,7 +9671,16 @@ BfTypeDef* BfModule::GetActiveTypeDef(BfTypeInstance* typeInstanceOverride, bool
if ((mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL) && (useMixinDecl))
useTypeDef = mCurMethodState->mMixinState->mMixinMethodInstance->mMethodDef->mDeclaringType->GetDefinition();
else if ((mCurMethodInstance != NULL) && (mCurMethodInstance->mMethodDef->mDeclaringType != NULL))
useTypeDef = mCurMethodInstance->mMethodDef->mDeclaringType->GetDefinition();
{
auto declTypeDef = mCurMethodInstance->mMethodDef->mDeclaringType;
useTypeDef = declTypeDef->GetDefinition();
if ((declTypeDef->IsEmitted()) && (useTypeDef->mIsCombinedPartial))
{
// Always consider methods to belong to the primary type declaration
useTypeDef = useTypeDef->mPartials[0];
}
}
else if (mContext->mCurTypeState != NULL)
{
if ((mContext->mCurTypeState->mCurFieldDef != NULL) && (mContext->mCurTypeState->mCurFieldDef->mDeclaringType != NULL))