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

Method GetWrappedStructType

IDEHelper/Compiler/BfModuleTypeUtils.cpp:7881–7933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7879}
7880
7881BfTypeInstance* BfModule::GetWrappedStructType(BfType* type, bool allowSpecialized)
7882{
7883 if (type->IsPointer())
7884 {
7885 if (allowSpecialized)
7886 {
7887 BfPointerType* pointerType = (BfPointerType*)type;
7888 BfTypeVector typeVector;
7889 typeVector.Add(pointerType->mElementType);
7890 return ResolveTypeDef(mCompiler->mPointerTTypeDef, typeVector, BfPopulateType_Data)->ToTypeInstance();
7891 }
7892 else
7893 return ResolveTypeDef(mCompiler->mPointerTTypeDef, BfPopulateType_Data)->ToTypeInstance();
7894 }
7895 else if (type->IsMethodRef())
7896 {
7897 if (allowSpecialized)
7898 {
7899 BfMethodRefType* methodRefType = (BfMethodRefType*)type;
7900 BfTypeVector typeVector;
7901 typeVector.Add(methodRefType);
7902 return ResolveTypeDef(mCompiler->mMethodRefTypeDef, typeVector, BfPopulateType_Data)->ToTypeInstance();
7903 }
7904 else
7905 return ResolveTypeDef(mCompiler->mMethodRefTypeDef, BfPopulateType_Data)->ToTypeInstance();
7906 }
7907 else if (type->IsSizedArray())
7908 {
7909 if (allowSpecialized)
7910 {
7911 if (type->IsUnknownSizedArrayType())
7912 {
7913 BfUnknownSizedArrayType* sizedArrayType = (BfUnknownSizedArrayType*)type;
7914 BfTypeVector typeVector;
7915 typeVector.Add(sizedArrayType->mElementType);
7916 typeVector.Add(sizedArrayType->mElementCountSource);
7917 return ResolveTypeDef(mCompiler->mSizedArrayTypeDef, typeVector, BfPopulateType_Data)->ToTypeInstance();
7918 }
7919
7920 BfSizedArrayType* sizedArrayType = (BfSizedArrayType*)type;
7921 BfTypeVector typeVector;
7922 typeVector.Add(sizedArrayType->mElementType);
7923 auto sizeValue = BfTypedValue(GetConstValue(BF_MAX(sizedArrayType->mElementCount, 0)), GetPrimitiveType(BfTypeCode_IntPtr));
7924 typeVector.Add(CreateConstExprValueType(sizeValue));
7925 return ResolveTypeDef(mCompiler->mSizedArrayTypeDef, typeVector, BfPopulateType_Data)->ToTypeInstance();
7926 }
7927 else
7928 return ResolveTypeDef(mCompiler->mSizedArrayTypeDef, BfPopulateType_Data)->ToTypeInstance();
7929 }
7930
7931 BF_ASSERT(type->IsPrimitiveType());
7932 return GetPrimitiveStructType(((BfPrimitiveType*)type)->mTypeDef->mTypeCode);
7933}
7934
7935BfPrimitiveType* BfModule::GetPrimitiveType(BfTypeCode typeCode)
7936{

Callers 15

AddTopLevelTypesMethod · 0.80
CheckMemberReferenceMethod · 0.80
ExecuteMethod · 0.80
InferGenericArgumentsMethod · 0.80
CheckMethodMethod · 0.80
TryDevirtualizeCallMethod · 0.80
LoadFieldMethod · 0.80
LookupFieldMethod · 0.80
AddCallDependenciesMethod · 0.80
MatchMethodMethod · 0.80
LookupQualifiedNameMethod · 0.80

Calls 8

BfTypedValueClass · 0.85
IsPointerMethod · 0.45
AddMethod · 0.45
ToTypeInstanceMethod · 0.45
IsMethodRefMethod · 0.45
IsSizedArrayMethod · 0.45
IsPrimitiveTypeMethod · 0.45

Tested by

no test coverage detected