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

Method GetVisibleProjectSet

IDEHelper/Compiler/BfModule.cpp:2597–2670  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2595}
2596
2597BfProjectSet* BfModule::GetVisibleProjectSet()
2598{
2599 if (mCurMethodState == NULL)
2600 return NULL;
2601
2602 if (mCurMethodState->mVisibleProjectSet.IsEmpty())
2603 {
2604 HashSet<BfType*> seenTypes;
2605
2606 std::function<void(BfProject* project)> _AddProject = [&](BfProject* project)
2607 {
2608 if (mCurMethodState->mVisibleProjectSet.Add(project))
2609 {
2610 for (auto dep : project->mDependencies)
2611 _AddProject(dep);
2612 }
2613 };
2614
2615 std::function<void(BfType* type)> _AddType = [&](BfType* type)
2616 {
2617 auto typeInstance = type->ToTypeInstance();
2618 if (typeInstance == NULL)
2619 {
2620 if (type->IsSizedArray())
2621 _AddType(type->GetUnderlyingType());
2622 return;
2623 }
2624 if (typeInstance->IsTuple())
2625 {
2626 for (auto& fieldInst : typeInstance->mFieldInstances)
2627 {
2628 if (fieldInst.mDataIdx != -1)
2629 _AddType(fieldInst.mResolvedType);
2630 }
2631 }
2632 _AddProject(typeInstance->mTypeDef->mProject);
2633 if (typeInstance->mGenericTypeInfo == NULL)
2634 return;
2635 for (auto type : typeInstance->mGenericTypeInfo->mTypeGenericArguments)
2636 {
2637 if (seenTypes.Add(type))
2638 _AddType(type);
2639 }
2640 };
2641
2642 if (mCurTypeInstance != NULL)
2643 {
2644 _AddType(mCurTypeInstance);
2645 if ((mContext->mCurTypeState != NULL) && (mContext->mCurTypeState->mType == mCurTypeInstance))
2646 {
2647 if (mContext->mCurTypeState->mCurTypeDef != NULL)
2648 _AddProject(mContext->mCurTypeState->mCurTypeDef->mProject);
2649 }
2650 }
2651
2652 auto methodState = mCurMethodState;
2653 while (methodState != NULL)
2654 {

Callers 4

IsMemberAccessibleMethod · 0.80
CheckTypeMethod · 0.80
LookupFieldMethod · 0.80
MatchConstructorMethod · 0.80

Calls 6

IsEmptyMethod · 0.45
AddMethod · 0.45
ToTypeInstanceMethod · 0.45
IsSizedArrayMethod · 0.45
GetUnderlyingTypeMethod · 0.45
IsTupleMethod · 0.45

Tested by

no test coverage detected