1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed issue with 'sticky' methodrefs

This commit is contained in:
Brian Fiete 2021-01-19 13:52:36 -08:00
parent 8f5f06bdb1
commit d5203f44db
2 changed files with 14 additions and 3 deletions

View file

@ -1219,6 +1219,13 @@ BfTypedValue BfMethodMatcher::ResolveArgTypedValue(BfResolvedArg& resolvedArg, B
}
else if ((resolvedArg.mArgFlags & BfArgFlag_LambdaBindAttempt) != 0)
{
if ((argTypedValue) && (argTypedValue.mType->IsMethodRef()) &&
((checkType == NULL) || (!checkType->IsMethodRef())))
{
// This may be from a previous checkMethod, clear it out
argTypedValue = BfTypedValue();
}
BfExprEvaluator exprEvaluator(mModule);
exprEvaluator.mExpectingType = checkType;
BF_ASSERT(resolvedArg.mExpression->IsA<BfLambdaBindExpression>());
@ -1246,7 +1253,7 @@ BfTypedValue BfMethodMatcher::ResolveArgTypedValue(BfResolvedArg& resolvedArg, B
}
}
}
else if ((checkType == NULL) && (origCheckType != NULL) && (origCheckType->IsUnspecializedTypeVariation()) && (genericArgumentsSubstitute != NULL))
else if ((checkType == NULL) && (origCheckType != NULL) && (origCheckType->IsUnspecializedTypeVariation()) && (genericArgumentsSubstitute != NULL) && (origCheckType->IsDelegateOrFunction()))
{
BfMethodInstance* methodInstance = mModule->GetRawMethodInstanceAtIdx(origCheckType->ToTypeInstance(), 0, "Invoke");
if (methodInstance != NULL)

View file

@ -547,6 +547,7 @@ public:
virtual bool IsArray() { return false; }
virtual bool IsDelegate() { return false; }
virtual bool IsFunction() { return false; }
virtual bool IsDelegateOrFunction() { return false; }
virtual bool IsDelegateFromTypeRef() { return false; }
virtual bool IsFunctionFromTypeRef() { return false; }
virtual BfDelegateInfo* GetDelegateInfo() { return NULL; }
@ -1926,6 +1927,7 @@ public:
virtual bool IsUnion() override { return mIsUnion; }
virtual bool IsDelegate() override { return mTypeDef->mIsDelegate; }
virtual bool IsFunction() override { return mTypeDef->mIsFunction; }
virtual bool IsDelegateOrFunction() override { return mTypeDef->mIsDelegate || mTypeDef->mIsFunction; }
virtual bool IsString() override;
virtual bool IsIntPtrable() override { return (mTypeDef->mTypeCode == BfTypeCode_Object) || (mTypeDef->mTypeCode == BfTypeCode_Interface); };
virtual bool IsEnum() override { return mTypeDef->mTypeCode == BfTypeCode_Enum; }
@ -2140,6 +2142,8 @@ public:
virtual bool IsFunction() override { return !mTypeDef->mIsDelegate; }
virtual bool IsFunctionFromTypeRef() override { return !mTypeDef->mIsDelegate; }
virtual bool IsDelegateOrFunction() override { return mTypeDef->mIsDelegate || mTypeDef->mIsFunction; }
virtual bool IsUnspecializedType() override { return mIsUnspecializedType; }
virtual bool IsUnspecializedTypeVariation() override { return mIsUnspecializedTypeVariation; }