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
|
@ -18864,8 +18864,27 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok
|
||||||
auto opResult = PerformUnaryOperation_TryOperator(thisValue, NULL, BfUnaryOp_NullConditional, dotToken, BfUnaryOpFlag_None);
|
auto opResult = PerformUnaryOperation_TryOperator(thisValue, NULL, BfUnaryOp_NullConditional, dotToken, BfUnaryOpFlag_None);
|
||||||
if (opResult)
|
if (opResult)
|
||||||
thisValue = opResult;
|
thisValue = opResult;
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
//TODO: But make null conditional work for Nullable types
|
|
||||||
if (thisValue.mType->IsNullable())
|
if (thisValue.mType->IsNullable())
|
||||||
{
|
{
|
||||||
// Success
|
// Success
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue