mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Prefer 'out' to 'ref' for method selection
This commit is contained in:
parent
7767df89dc
commit
ded495a07b
1 changed files with 11 additions and 0 deletions
|
@ -971,6 +971,17 @@ void BfMethodMatcher::CompareMethods(BfMethodInstance* prevMethodInstance, BfTyp
|
|||
}
|
||||
}
|
||||
|
||||
if ((!isBetter) && (!isWorse) && (paramType->IsRef()) && (prevParamType->IsRef()))
|
||||
{
|
||||
auto refType = (BfRefType*)paramType;
|
||||
auto prevRefType = (BfRefType*)prevParamType;
|
||||
|
||||
// Prefer 'out' to 'ref'
|
||||
SET_BETTER_OR_WORSE(
|
||||
(refType->mRefKind == BfRefType::RefKind_Out) && (prevRefType->mRefKind == BfRefType::RefKind_Ref),
|
||||
(refType->mRefKind == BfRefType::RefKind_Ref) && (prevRefType->mRefKind == BfRefType::RefKind_Out));
|
||||
}
|
||||
|
||||
if ((newArgIdx >= 0) && (newMethodInstance->GetParamKind(newArgIdx) == BfParamKind_Params))
|
||||
usedExtendedForm = true;
|
||||
if ((prevArgIdx >= 0) && (prevMethodInstance->GetParamKind(prevArgIdx) == BfParamKind_Params))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue