mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fixed a type primitive cast issue
This commit is contained in:
parent
3483c9de58
commit
70b008586f
1 changed files with 10 additions and 50 deletions
|
@ -1761,31 +1761,19 @@ DbgTypedValue DbgExprEvaluator::Cast(BfAstNode* srcNode, const DbgTypedValue& ty
|
||||||
if (fromType->mTypeCode == toType->mTypeCode)
|
if (fromType->mTypeCode == toType->mTypeCode)
|
||||||
return typedVal;
|
return typedVal;
|
||||||
|
|
||||||
// Typed primitive?
|
if ((fromType->IsStruct()) || (fromType->IsEnum()))
|
||||||
int thisOffset = 0;
|
{
|
||||||
addr_target thisVal = typedVal.mSrcAddress;
|
if (fromType->mTypeParam != NULL)
|
||||||
if (TypeIsSubTypeOf(fromType, toType, &thisOffset, &thisVal))
|
|
||||||
{
|
|
||||||
if (typedVal.mSrcAddress == 0)
|
|
||||||
{
|
{
|
||||||
if (fromType->IsTypedPrimitive())
|
DbgTypedValue underlyingTypedValue = typedVal;
|
||||||
{
|
underlyingTypedValue.mType = fromType->mTypeParam;
|
||||||
DbgTypedValue val = typedVal;
|
auto castedVal = Cast(srcNode, underlyingTypedValue, toType, explicitCast, true);
|
||||||
val.mType = toType;
|
if (castedVal)
|
||||||
return val;
|
return castedVal;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
DbgTypedValue val = ReadTypedValue(toType, typedVal.mSrcAddress, DbgAddrType_Target);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Check to see if other types are equal as well
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (toType->IsBfObject())
|
|
||||||
toType = mDbgModule->GetPointerType(toType);*/
|
|
||||||
|
|
||||||
if (fromType == toType)
|
if (fromType == toType)
|
||||||
return typedVal;
|
return typedVal;
|
||||||
|
|
||||||
|
@ -1798,34 +1786,6 @@ DbgTypedValue DbgExprEvaluator::Cast(BfAstNode* srcNode, const DbgTypedValue& ty
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if ((fromType->IsConst()) || (toType->IsConst()))
|
|
||||||
{
|
|
||||||
auto checkFromType = fromType;
|
|
||||||
if (checkFromType->IsConst())
|
|
||||||
checkFromType = checkFromType->mTypeParam;
|
|
||||||
auto checkToType = toType;
|
|
||||||
if (checkToType->IsConst())
|
|
||||||
checkToType = checkToType->mTypeParam;
|
|
||||||
DbgTypedValue checkVal = typedVal;
|
|
||||||
checkVal.mType = checkFromType;
|
|
||||||
|
|
||||||
auto result = Cast(srcNode, checkVal, checkToType, explicitCast, true);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
result.mType = toType;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*if ((fromType->IsPointer()) && (toType->IsCompositeType()))
|
|
||||||
{
|
|
||||||
DbgType* toPtrType = mDbgModule->GetPointerType(toType);
|
|
||||||
DbgTypedValue val;
|
|
||||||
val.mPtr = typedVal.mPtr;
|
|
||||||
val.mType = toPtrType;
|
|
||||||
return val;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
auto curTypeInstance = GetCurrentType();
|
auto curTypeInstance = GetCurrentType();
|
||||||
|
|
||||||
if ((fromType->IsCompositeType()) && ((toType->IsCompositeType() || (toType->IsInterface()))))
|
if ((fromType->IsCompositeType()) && ((toType->IsCompositeType() || (toType->IsInterface()))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue