| 6327 | } |
| 6328 | |
| 6329 | BfIRValue BfModule::CreateTypeDeclData(BfType* type, BfProject* curProject) |
| 6330 | { |
| 6331 | auto typeDeclType = ResolveTypeDef(mCompiler->mTypeTypeDeclDef)->ToTypeInstance(); |
| 6332 | |
| 6333 | int typeCode = 0; |
| 6334 | int typeFlags = 0; |
| 6335 | |
| 6336 | BfCreateTypeDataContext createTypeDataCtx; |
| 6337 | BfIRValue typeTypeData = GetTypeTypeData(type, createTypeDataCtx, true, true, true, typeFlags, typeCode); |
| 6338 | |
| 6339 | SizedArray<BfIRValue, 4> typeValueParams; |
| 6340 | GetConstClassValueParam(typeTypeData, typeValueParams); |
| 6341 | |
| 6342 | BfType* longType = GetPrimitiveType(BfTypeCode_Int64); |
| 6343 | BfType* intType = GetPrimitiveType(BfTypeCode_Int32); |
| 6344 | BfType* intPtrType = GetPrimitiveType(BfTypeCode_IntPtr); |
| 6345 | BfType* shortType = GetPrimitiveType(BfTypeCode_Int16); |
| 6346 | BfType* byteType = GetPrimitiveType(BfTypeCode_Int8); |
| 6347 | |
| 6348 | BfType* typeIdType = intType; |
| 6349 | |
| 6350 | auto typeInst = type->ToTypeInstance(); |
| 6351 | |
| 6352 | auto outerType = GetOuterType(type); |
| 6353 | BfType* baseType = NULL; |
| 6354 | if (typeInst != NULL) |
| 6355 | baseType = typeInst->mBaseType; |
| 6356 | |
| 6357 | enum BfTypeDeclFlags |
| 6358 | { |
| 6359 | BfTypeDeclFlag_DeclaredInDependency = 1, |
| 6360 | BfTypeDeclFlag_DeclaredInDependent = 2, |
| 6361 | BfTypeDeclFlag_DeclaredInCurrent = 4, |
| 6362 | BfTypeDeclFlag_AlwaysVisible = 8, |
| 6363 | BfTypeDeclFlag_SometimesVisible = 0x10 |
| 6364 | }; |
| 6365 | int flags = 0; |
| 6366 | |
| 6367 | if (typeInst != NULL) |
| 6368 | { |
| 6369 | auto declProject = typeInst->mTypeDef->mProject; |
| 6370 | |
| 6371 | auto depKind = curProject->GetDependencyKind(declProject); |
| 6372 | |
| 6373 | if (depKind == BfProject::DependencyKind_Identity) |
| 6374 | { |
| 6375 | flags |= BfTypeDeclFlag_DeclaredInCurrent | BfTypeDeclFlag_AlwaysVisible | BfTypeDeclFlag_SometimesVisible; |
| 6376 | } |
| 6377 | else if (depKind == BfProject::DependencyKind_Dependency) |
| 6378 | { |
| 6379 | flags |= BfTypeDeclFlag_DeclaredInDependency | BfTypeDeclFlag_AlwaysVisible | BfTypeDeclFlag_SometimesVisible; |
| 6380 | } |
| 6381 | else if (depKind == BfProject::DependencyKind_Dependent_Exclusive) |
| 6382 | { |
| 6383 | flags |= BfTypeDeclFlag_DeclaredInDependent | BfTypeDeclFlag_AlwaysVisible | BfTypeDeclFlag_SometimesVisible; |
| 6384 | } |
| 6385 | else if (depKind == BfProject::DependencyKind_Dependent_Shared) |
| 6386 | { |
no test coverage detected