1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Handle 'func?.Invoke()'

This commit is contained in:
Brian Fiete 2025-01-18 06:48:33 -08:00
parent a1cd01cd3d
commit 910f560380
2 changed files with 14 additions and 3 deletions

View file

@ -21803,7 +21803,7 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
{
// Success
}
else if ((thisValue.mType->IsPointer()) || (thisValue.mType->IsObjectOrInterface()))
else if ((thisValue.mType->IsPointer()) || (thisValue.mType->IsObjectOrInterface()) || (thisValue.mType->IsFunction()))
{
// Also good
}
@ -21863,6 +21863,10 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
thisValue = BfTypedValue(valuePtr, elementType, true);
}
}
else if (thisValue.mType->IsFunction())
{
isNotNull = mModule->mBfIRBuilder->CreateCmpNE(thisValue.mValue, mModule->GetDefaultValue(thisValue.mType));
}
else
isNotNull = mModule->mBfIRBuilder->CreateIsNotNull(thisValue.mValue);
BfIRBlock notNullBB = mModule->mBfIRBuilder->CreateBlock("nullCond.notNull");