| 509 | } |
| 510 | |
| 511 | bool BfCompiler::IsTypeAccessible(BfType* checkType, BfProject* curProject) |
| 512 | { |
| 513 | if (checkType->IsBoxed()) |
| 514 | return IsTypeAccessible(((BfBoxedType*)checkType)->mElementType, curProject); |
| 515 | |
| 516 | BfTypeInstance* typeInst = checkType->ToTypeInstance(); |
| 517 | if (typeInst != NULL) |
| 518 | { |
| 519 | if (checkType->IsTuple()) |
| 520 | { |
| 521 | for (auto&& fieldInst : typeInst->mFieldInstances) |
| 522 | { |
| 523 | if (!IsTypeAccessible(fieldInst.mResolvedType, curProject)) |
| 524 | return false; |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | auto genericTypeInst = typeInst->ToGenericTypeInstance(); |
| 529 | if (genericTypeInst != NULL) |
| 530 | { |
| 531 | for (auto genericArg : genericTypeInst->mGenericTypeInfo->mTypeGenericArguments) |
| 532 | if (!IsTypeAccessible(genericArg, curProject)) |
| 533 | return false; |
| 534 | } |
| 535 | |
| 536 | return curProject->ContainsReference(typeInst->mTypeDef->mProject); |
| 537 | } |
| 538 | |
| 539 | if (checkType->IsPointer()) |
| 540 | return IsTypeAccessible(((BfPointerType*)checkType)->mElementType, curProject); |
| 541 | if (checkType->IsRef()) |
| 542 | return IsTypeAccessible(((BfPointerType*)checkType)->mElementType, curProject); |
| 543 | |
| 544 | return true; |
| 545 | } |
| 546 | |
| 547 | bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject) |
| 548 | { |
nothing calls this directly
no test coverage detected