mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Fixed arg name failure in generic method selection
This commit is contained in:
parent
5416d30bf1
commit
1a85562d54
1 changed files with 32 additions and 32 deletions
|
@ -1752,38 +1752,6 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
|||
}
|
||||
}
|
||||
|
||||
if (mHasArgNames)
|
||||
{
|
||||
checkMethod->BuildParamNameMap();
|
||||
|
||||
bool prevWasNull = false;
|
||||
for (int argIdx = (int)mArguments.mSize - 1; argIdx >= 0; argIdx--)
|
||||
{
|
||||
auto& arg = mArguments[argIdx];
|
||||
if (arg.mNameNode != NULL)
|
||||
{
|
||||
if (prevWasNull)
|
||||
{
|
||||
if (argIdx >= checkMethod->mParams.mSize)
|
||||
goto NoMatch;
|
||||
if (checkMethod->mParams[argIdx]->mName != arg.mNameNode->ToStringView())
|
||||
goto NoMatch;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!checkMethod->mParamNameMap->ContainsKey(arg.mNameNode->ToStringView()))
|
||||
goto NoMatch;
|
||||
}
|
||||
|
||||
prevWasNull = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
prevWasNull = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& checkGenericArgRef : mCheckMethodGenericArguments)
|
||||
checkGenericArgRef = NULL;
|
||||
|
||||
|
@ -1820,6 +1788,38 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
|
|||
else if (needInferGenericParams)
|
||||
genericArgumentsSubstitute = &mCheckMethodGenericArguments;
|
||||
|
||||
if (mHasArgNames)
|
||||
{
|
||||
checkMethod->BuildParamNameMap();
|
||||
|
||||
bool prevWasNull = false;
|
||||
for (int argIdx = (int)mArguments.mSize - 1; argIdx >= 0; argIdx--)
|
||||
{
|
||||
auto& arg = mArguments[argIdx];
|
||||
if (arg.mNameNode != NULL)
|
||||
{
|
||||
if (prevWasNull)
|
||||
{
|
||||
if (argIdx >= checkMethod->mParams.mSize)
|
||||
goto NoMatch;
|
||||
if (checkMethod->mParams[argIdx]->mName != arg.mNameNode->ToStringView())
|
||||
goto NoMatch;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!checkMethod->mParamNameMap->ContainsKey(arg.mNameNode->ToStringView()))
|
||||
goto NoMatch;
|
||||
}
|
||||
|
||||
prevWasNull = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
prevWasNull = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((checkMethod->mIsMutating) && (targetTypeInstance != NULL) && (targetTypeInstance->IsValueType()) &&
|
||||
((mTarget.IsReadOnly()) || (!mTarget.IsAddr())) &&
|
||||
(!targetTypeInstance->IsValuelessType()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue