mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +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);
|
auto lookupType = BindGenericType(nameNode, mResult.mType);
|
||||||
if ((lookupType->IsGenericParam()) && (!mResult.mType->IsGenericParam()))
|
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
|
// Try to lookup from generic binding
|
||||||
mResult = LookupField(nameRight, BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), lookupType), fieldName, BfLookupFieldFlag_BindOnly);
|
mResult = LookupField(nameRight, BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), lookupType), fieldName, BfLookupFieldFlag_BindOnly);
|
||||||
|
|
||||||
|
if (mModule->mCurMethodState->mMixinState != NULL)
|
||||||
|
mModule->mCurMethodState->mMixinState->mUseMixinGenerics = prevUseMixinGenerics;
|
||||||
|
|
||||||
if (mPropDef != NULL)
|
if (mPropDef != NULL)
|
||||||
{
|
{
|
||||||
mOrigPropTarget = lookupVal;
|
mOrigPropTarget = lookupVal;
|
||||||
|
|
|
@ -830,6 +830,7 @@ public:
|
||||||
bool mHasDeferredUsage;
|
bool mHasDeferredUsage;
|
||||||
bool mCheckedCircularRef;
|
bool mCheckedCircularRef;
|
||||||
bool mDoCircularVarResult;
|
bool mDoCircularVarResult;
|
||||||
|
bool mUseMixinGenerics;
|
||||||
BfTypedValue mTarget;
|
BfTypedValue mTarget;
|
||||||
int mLastTargetAccessId;
|
int mLastTargetAccessId;
|
||||||
|
|
||||||
|
@ -847,6 +848,7 @@ public:
|
||||||
mHasDeferredUsage = false;
|
mHasDeferredUsage = false;
|
||||||
mCheckedCircularRef = false;
|
mCheckedCircularRef = false;
|
||||||
mDoCircularVarResult = false;
|
mDoCircularVarResult = false;
|
||||||
|
mUseMixinGenerics = false;
|
||||||
mLastTargetAccessId = -1;
|
mLastTargetAccessId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9358,8 +9358,11 @@ BfGenericParamInstance* BfModule::GetGenericParamInstance(BfGenericParamType* ty
|
||||||
if (type->mGenericParamKind == BfGenericParamKind_Method)
|
if (type->mGenericParamKind == BfGenericParamKind_Method)
|
||||||
{
|
{
|
||||||
auto curGenericMethodInstance = mCurMethodInstance;
|
auto curGenericMethodInstance = mCurMethodInstance;
|
||||||
if ((checkMixinBind) && (mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL))
|
if ((mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL))
|
||||||
curGenericMethodInstance = mCurMethodState->mMixinState->mMixinMethodInstance;
|
{
|
||||||
|
if ((checkMixinBind) || (mCurMethodState->mMixinState->mUseMixinGenerics))
|
||||||
|
curGenericMethodInstance = mCurMethodState->mMixinState->mMixinMethodInstance;
|
||||||
|
}
|
||||||
|
|
||||||
if ((curGenericMethodInstance == NULL) || (curGenericMethodInstance->mMethodInfoEx == NULL) || (type->mGenericParamIdx >= curGenericMethodInstance->mMethodInfoEx->mGenericParams.mSize))
|
if ((curGenericMethodInstance == NULL) || (curGenericMethodInstance->mMethodInfoEx == NULL) || (type->mGenericParamIdx >= curGenericMethodInstance->mMethodInfoEx->mGenericParams.mSize))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue