1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Added 'in' parameter support

This commit is contained in:
Brian Fiete 2021-01-27 09:01:47 -08:00
parent bf97870ed4
commit 4d1672fbcf
8 changed files with 52 additions and 16 deletions

View file

@ -2069,7 +2069,8 @@ bool BfMethodMatcher::CheckMethod(BfTypeInstance* targetTypeInstance, BfTypeInst
}
else
{
if ((mAllowImplicitRef) && (wantType->IsRef()) && (!argTypedValue.mType->IsRef()))
if ((wantType->IsRef()) && (!argTypedValue.mType->IsRef()) &&
((mAllowImplicitRef) || (wantType->IsIn())))
wantType = wantType->GetUnderlyingType();
if (!mModule->CanCast(argTypedValue, wantType))
goto NoMatch;
@ -3662,7 +3663,7 @@ BfTypedValue BfExprEvaluator::LoadLocal(BfLocalVariable* varDecl, bool allowRef)
}
}
localResult = BfTypedValue(varDecl->mValue, innerType, BfTypedValueKind_Addr);
localResult = BfTypedValue(varDecl->mValue, innerType, varDecl->mIsReadOnly ? BfTypedValueKind_ReadOnlyAddr : BfTypedValueKind_Addr);
}
else
{
@ -7011,8 +7012,8 @@ BfTypedValue BfExprEvaluator::CreateCall(BfAstNode* targetSrc, const BfTypedValu
if (refNode == NULL)
refNode = targetSrc;
if (((callFlags & BfCreateFallFlags_AllowImplicitRef) != 0) &&
(wantType->IsRef()) && (!argValue.mType->IsRef()))
if ((wantType->IsRef()) && (!argValue.mType->IsRef()) &&
(((callFlags & BfCreateFallFlags_AllowImplicitRef) != 0) || (wantType->IsIn())))
argValue = mModule->ToRef(argValue, (BfRefType*)wantType);
if (mModule->mCurMethodState != NULL)