MCPcopy Create free account
hub / github.com/beefytech/Beef / ResolveTypeRef

Method ResolveTypeRef

IDEHelper/DbgExprEvaluator.cpp:918–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

916}
917
918DbgType* DbgExprEvaluator::ResolveTypeRef(BfTypeReference* typeRef)
919{
920 mDbgModule->ParseTypeData();
921
922 if (auto ptrTypeRef = BfNodeDynCastExact<BfPointerTypeRef>(typeRef))
923 {
924 // If it's a pointer type ref then create our own type
925 auto innerType = ResolveTypeRef(ptrTypeRef->mElementType);
926 if (innerType == NULL)
927 return NULL;
928 return mDbgModule->GetPointerType(innerType);
929 }
930
931 if (auto arrayTypeRef = BfNodeDynCastExact<BfArrayTypeRef>(typeRef))
932 {
933 if (arrayTypeRef->mParams.size() == 1)
934 {
935 if (auto literalExpr = BfNodeDynCastExact<BfLiteralExpression>(arrayTypeRef->mParams[0]))
936 {
937 auto elementType = ResolveTypeRef(arrayTypeRef->mElementType);
938 if (elementType == NULL)
939 return NULL;
940
941 int count = 1;
942 if ((literalExpr->mValue.mTypeCode >= BfTypeCode_Int16) && (literalExpr->mValue.mTypeCode <= BfTypeCode_UIntUnknown))
943 {
944 count = literalExpr->mValue.mInt32;
945 if (count < 0)
946 {
947 Fail(StrFormat("Illegal array size"), arrayTypeRef->mParams[0]);
948 count = 1;
949 }
950 }
951 else
952 {
953 Fail(StrFormat("Illegal array size type"), arrayTypeRef->mParams[0]);
954 }
955
956 return mDbgModule->GetSizedArrayType(elementType, count);
957 }
958 }
959 }
960
961 if (auto declTypeRef = BfNodeDynCastExact<BfExprModTypeRef>(typeRef))
962 {
963 mResult = DbgTypedValue();
964 VisitChild(declTypeRef->mTarget);
965 auto type = mResult.mType;
966 mResult = DbgTypedValue();
967 return type;
968 }
969
970 String name = typeRef->ToString();
971 if (name.StartsWith("_T_"))
972 {
973 auto dbgModule = mDbgModule;
974
975 char* endPtr = NULL;

Callers 1

DwMethodMatcherMethod · 0.45

Calls 15

FailFunction · 0.85
DbgTypedValueClass · 0.85
NodeReplaceRecordClass · 0.85
GetPointerTypeMethod · 0.80
TryGetValueMethod · 0.80
ParseTypeDataMethod · 0.45
sizeMethod · 0.45
GetSizedArrayTypeMethod · 0.45
ToStringMethod · 0.45
StartsWithMethod · 0.45
c_strMethod · 0.45
FindMethod · 0.45

Tested by

no test coverage detected