mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 19:48:20 +02:00
Fixed mixin generic bind issue with BfLookupFieldFlag_BindOnly
This commit is contained in:
parent
1183007a90
commit
e28b9c8325
3 changed files with 18 additions and 2 deletions
|
@ -10981,8 +10981,19 @@ void BfExprEvaluator::LookupQualifiedName(BfAstNode* nameNode, BfIdentifierNode*
|
|||
auto lookupType = BindGenericType(nameNode, mResult.mType);
|
||||
if ((lookupType->IsGenericParam()) && (!mResult.mType->IsGenericParam()))
|
||||
{
|
||||
bool prevUseMixinGenerics = false;
|
||||
if (mModule->mCurMethodState->mMixinState != NULL)
|
||||
{
|
||||
prevUseMixinGenerics = mModule->mCurMethodState->mMixinState->mUseMixinGenerics;
|
||||
mModule->mCurMethodState->mMixinState->mUseMixinGenerics = true;
|
||||
}
|
||||
|
||||
// Try to lookup from generic binding
|
||||
mResult = LookupField(nameRight, BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), lookupType), fieldName, BfLookupFieldFlag_BindOnly);
|
||||
|
||||
if (mModule->mCurMethodState->mMixinState != NULL)
|
||||
mModule->mCurMethodState->mMixinState->mUseMixinGenerics = prevUseMixinGenerics;
|
||||
|
||||
if (mPropDef != NULL)
|
||||
{
|
||||
mOrigPropTarget = lookupVal;
|
||||
|
|
|
@ -830,6 +830,7 @@ public:
|
|||
bool mHasDeferredUsage;
|
||||
bool mCheckedCircularRef;
|
||||
bool mDoCircularVarResult;
|
||||
bool mUseMixinGenerics;
|
||||
BfTypedValue mTarget;
|
||||
int mLastTargetAccessId;
|
||||
|
||||
|
@ -847,6 +848,7 @@ public:
|
|||
mHasDeferredUsage = false;
|
||||
mCheckedCircularRef = false;
|
||||
mDoCircularVarResult = false;
|
||||
mUseMixinGenerics = false;
|
||||
mLastTargetAccessId = -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -9358,8 +9358,11 @@ BfGenericParamInstance* BfModule::GetGenericParamInstance(BfGenericParamType* ty
|
|||
if (type->mGenericParamKind == BfGenericParamKind_Method)
|
||||
{
|
||||
auto curGenericMethodInstance = mCurMethodInstance;
|
||||
if ((checkMixinBind) && (mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL))
|
||||
curGenericMethodInstance = mCurMethodState->mMixinState->mMixinMethodInstance;
|
||||
if ((mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL))
|
||||
{
|
||||
if ((checkMixinBind) || (mCurMethodState->mMixinState->mUseMixinGenerics))
|
||||
curGenericMethodInstance = mCurMethodState->mMixinState->mMixinMethodInstance;
|
||||
}
|
||||
|
||||
if ((curGenericMethodInstance == NULL) || (curGenericMethodInstance->mMethodInfoEx == NULL) || (type->mGenericParamIdx >= curGenericMethodInstance->mMethodInfoEx->mGenericParams.mSize))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue