| 916 | } |
| 917 | |
| 918 | DbgType* 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; |
no test coverage detected