mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Improved pointer generic constraints
This commit is contained in:
parent
0bdaa03545
commit
195463cb77
3 changed files with 27 additions and 9 deletions
|
@ -23498,6 +23498,15 @@ void BfExprEvaluator::PerformUnaryOperation_OnResult(BfExpression* unaryOpExpr,
|
|||
case BfUnaryOp_Dereference:
|
||||
{
|
||||
CheckResultForReading(mResult);
|
||||
if (mResult.mType->IsGenericParam())
|
||||
{
|
||||
auto genericParamInstance = mModule->GetGenericParamInstance((BfGenericParamType*)mResult.mType);
|
||||
if ((genericParamInstance->mTypeConstraint != NULL) && (genericParamInstance->mTypeConstraint->IsPointer()))
|
||||
{
|
||||
mResult = mModule->GetDefaultTypedValue(genericParamInstance->mTypeConstraint->GetUnderlyingType(), false, BfDefaultValueKind_Addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!mResult.mType->IsPointer())
|
||||
{
|
||||
mResult = BfTypedValue();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue