mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Made dot-constructors work with nullables
This commit is contained in:
parent
73de7b1fd0
commit
3c40f80f6d
1 changed files with 12 additions and 4 deletions
|
@ -14035,15 +14035,23 @@ void BfExprEvaluator::DoInvocation(BfAstNode* target, BfMethodBoundExpression* m
|
||||||
BfResolveArgFlags resolveArgsFlags = BfResolveArgFlag_DeferParamEval;
|
BfResolveArgFlags resolveArgsFlags = BfResolveArgFlag_DeferParamEval;
|
||||||
ResolveArgValues(argValues, resolveArgsFlags);
|
ResolveArgValues(argValues, resolveArgsFlags);
|
||||||
|
|
||||||
if ((mReceivingValue != NULL) && (mReceivingValue->mType == mExpectingType) && (mReceivingValue->IsAddr()))
|
auto expectingType = mExpectingType;
|
||||||
|
if (expectingType->IsNullable())
|
||||||
|
{
|
||||||
|
auto underlyingType = expectingType->GetUnderlyingType();
|
||||||
|
if (underlyingType->IsTypeInstance())
|
||||||
|
expectingType = underlyingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mReceivingValue != NULL) && (mReceivingValue->mType == expectingType) && (mReceivingValue->IsAddr()))
|
||||||
{
|
{
|
||||||
mResult = *mReceivingValue;
|
mResult = *mReceivingValue;
|
||||||
mReceivingValue = NULL;
|
mReceivingValue = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mResult = BfTypedValue(mModule->CreateAlloca(mExpectingType), mExpectingType, BfTypedValueKind_TempAddr);
|
mResult = BfTypedValue(mModule->CreateAlloca(expectingType), expectingType, BfTypedValueKind_TempAddr);
|
||||||
MatchConstructor(target, methodBoundExpr, mResult, mExpectingType->ToTypeInstance(), argValues, false, false);
|
MatchConstructor(target, methodBoundExpr, mResult, expectingType->ToTypeInstance(), argValues, false, false);
|
||||||
mModule->ValidateAllocation(mExpectingType, invocationExpr->mTarget);
|
mModule->ValidateAllocation(expectingType, invocationExpr->mTarget);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue