| 6182 | } |
| 6183 | |
| 6184 | BfIRValue BfModule::GetTypeTypeData(BfType* type, BfCreateTypeDataContext& ctx, bool needsTypeData, bool wantsTypeDecl, bool needsTypeNames, int& typeFlags, int& typeCode) |
| 6185 | { |
| 6186 | BfTypeInstance* typeInstance = type->ToTypeInstance(); |
| 6187 | BfType* typeInstanceType = ResolveTypeDef(mCompiler->mReflectTypeInstanceTypeDef); |
| 6188 | mBfIRBuilder->PopulateType(typeInstanceType, BfIRPopulateType_Full_ForceDefinition); |
| 6189 | |
| 6190 | BfIRValue typeTypeData; |
| 6191 | if (needsTypeData) |
| 6192 | { |
| 6193 | BfTypeInstance* typeInstanceTypeInstance = typeInstanceType->ToTypeInstance(); |
| 6194 | |
| 6195 | BfTypeInstance* typeDataSource = NULL; |
| 6196 | |
| 6197 | if (typeInstance != NULL) |
| 6198 | { |
| 6199 | if (typeInstance->IsUnspecializedType()) |
| 6200 | { |
| 6201 | typeDataSource = ResolveTypeDef(mCompiler->mReflectUnspecializedGenericType)->ToTypeInstance(); |
| 6202 | typeFlags |= BfTypeFlags_UnspecializedGeneric; |
| 6203 | } |
| 6204 | else if (typeInstance->IsArray()) |
| 6205 | { |
| 6206 | typeDataSource = ResolveTypeDef(mCompiler->mReflectArrayType)->ToTypeInstance(); |
| 6207 | typeFlags |= BfTypeFlags_Array; |
| 6208 | } |
| 6209 | else if (typeInstance->IsGenericTypeInstance()) |
| 6210 | { |
| 6211 | typeDataSource = ResolveTypeDef(mCompiler->mReflectSpecializedGenericType)->ToTypeInstance(); |
| 6212 | typeFlags |= BfTypeFlags_SpecializedGeneric; |
| 6213 | } |
| 6214 | else |
| 6215 | typeDataSource = typeInstanceTypeInstance; |
| 6216 | } |
| 6217 | else if (type->IsPointer()) |
| 6218 | typeDataSource = ResolveTypeDef(mCompiler->mReflectPointerType)->ToTypeInstance(); |
| 6219 | else if (type->IsRef()) |
| 6220 | typeDataSource = ResolveTypeDef(mCompiler->mReflectRefType)->ToTypeInstance(); |
| 6221 | else if (type->IsSizedArray()) |
| 6222 | typeDataSource = ResolveTypeDef(mCompiler->mReflectSizedArrayType)->ToTypeInstance(); |
| 6223 | else if (type->IsConstExprValue()) |
| 6224 | typeDataSource = ResolveTypeDef(mCompiler->mReflectConstExprType)->ToTypeInstance(); |
| 6225 | else if (type->IsGenericParam()) |
| 6226 | { |
| 6227 | typeFlags |= BfTypeFlags_GenericParam; |
| 6228 | typeDataSource = ResolveTypeDef(mCompiler->mReflectGenericParamType)->ToTypeInstance(); |
| 6229 | } |
| 6230 | else |
| 6231 | typeDataSource = mContext->mBfTypeType; |
| 6232 | |
| 6233 | if (wantsTypeDecl) |
| 6234 | { |
| 6235 | typeDataSource = ResolveTypeDef(mCompiler->mTypeTypeDeclDef)->ToTypeInstance(); |
| 6236 | } |
| 6237 | |
| 6238 | if ((!mTypeDataRefs.ContainsKey(typeDataSource)) && (typeDataSource != type) && (!mIsComptimeModule)) |
| 6239 | { |
| 6240 | CreateTypeData(typeDataSource, ctx, false, true, needsTypeNames, true); |
| 6241 | } |
nothing calls this directly
no test coverage detected