mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Handle 'func?.Invoke()'
This commit is contained in:
parent
a1cd01cd3d
commit
910f560380
2 changed files with 14 additions and 3 deletions
|
@ -980,8 +980,15 @@ void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bo
|
|||
}
|
||||
else
|
||||
{
|
||||
canUseMethod &= (CHECK_STATIC(methodDef->mIsStatic) &&
|
||||
(mModule->CheckProtection(protectionCheckFlags, typeInst, methodDef->mDeclaringType->mProject, methodDef->mProtection, startType)));
|
||||
if (typeInst->IsFunction())
|
||||
{
|
||||
canUseMethod = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
canUseMethod &= (CHECK_STATIC(methodDef->mIsStatic) &&
|
||||
(mModule->CheckProtection(protectionCheckFlags, typeInst, methodDef->mDeclaringType->mProject, methodDef->mProtection, startType)));
|
||||
}
|
||||
}
|
||||
if (canUseMethod)
|
||||
{
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue