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

Method IsTypeAccessible

IDEHelper/Compiler/BfCompiler.cpp:511–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

509}
510
511bool 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
547bool BfCompiler::IsTypeUsed(BfType* checkType, BfProject* curProject)
548{

Callers

nothing calls this directly

Calls 7

ContainsReferenceMethod · 0.80
IsBoxedMethod · 0.45
ToTypeInstanceMethod · 0.45
IsTupleMethod · 0.45
ToGenericTypeInstanceMethod · 0.45
IsPointerMethod · 0.45
IsRefMethod · 0.45

Tested by

no test coverage detected