mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-14 14:24:10 +02:00
Handled SetupNullConditional generic param cases
This commit is contained in:
parent
d998fe2229
commit
74861b17a3
1 changed files with 20 additions and 1 deletions
|
@ -18865,7 +18865,26 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
|
|||
if (opResult)
|
||||
thisValue = opResult;
|
||||
|
||||
//TODO: But make null conditional work for Nullable types
|
||||
if (thisValue.mType->IsGenericParam())
|
||||
{
|
||||
bool isValid = false;
|
||||
|
||||
auto genericParams = mModule->GetGenericParamInstance((BfGenericParamType*)thisValue.mType);
|
||||
if (genericParams->mTypeConstraint != NULL)
|
||||
{
|
||||
if ((genericParams->mTypeConstraint->IsNullable()) ||
|
||||
(genericParams->mTypeConstraint->IsPointer()) ||
|
||||
(genericParams->mTypeConstraint->IsObjectOrInterface()))
|
||||
isValid = true;
|
||||
}
|
||||
|
||||
if ((genericParams->mGenericParamFlags & (BfGenericParamFlag_Var | BfGenericParamFlag_StructPtr | BfGenericParamFlag_Class)) != 0)
|
||||
isValid = true;
|
||||
|
||||
if (isValid)
|
||||
return thisValue;
|
||||
}
|
||||
|
||||
if (thisValue.mType->IsNullable())
|
||||
{
|
||||
// Success
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue