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

Method FindTypeDef

IDEHelper/Compiler/BfSystem.cpp:2660–2763  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2658}
2659
2660BfTypeDef* BfSystem::FindTypeDef(const BfAtomComposite& findName, int numGenericArgs, BfProject* project, const Array<BfAtomComposite>& namespaceSearch, BfTypeDef** ambiguousTypeDef, BfFindTypeDefFlags flags)
2661{
2662 if (findName.GetPartsCount() == 1)
2663 {
2664 BfTypeDef** typeDefPtr = NULL;
2665 if (mSystemTypeDefs.TryGetValueWith(findName.mParts[0]->mString, &typeDefPtr))
2666 return FilterDeletedTypeDef(*typeDefPtr);
2667 }
2668
2669 // This searched globals, but we were already doing that down below at the LAST step. Right?
2670 BfTypeDef* foundTypeDef = NULL;
2671 BfAtomCompositeT<16> qualifiedFindName;
2672
2673 bool allowGlobal = (flags & BfFindTypeDefFlag_AllowGlobal) != 0;
2674
2675 int foundPri = (int)0x80000000;
2676 for (int namespaceIdx = 0; namespaceIdx <= (int) namespaceSearch.size(); namespaceIdx++)
2677 {
2678 int curNamespacePri = 0;
2679 if (namespaceIdx < (int)namespaceSearch.size())
2680 {
2681 auto& namespaceDeclaration = namespaceSearch[namespaceIdx];
2682 qualifiedFindName.Set(namespaceDeclaration, findName);
2683 }
2684 else
2685 {
2686 qualifiedFindName = findName;
2687 }
2688
2689 int partialStartEntryIdx = -1;
2690
2691 auto itr = mTypeDefs.TryGet(qualifiedFindName);
2692 while (itr)
2693 {
2694 BfTypeDef* typeDef = *itr;
2695
2696 if ((typeDef->mIsPartial) ||
2697 ((typeDef->IsGlobalsContainer()) && ((flags & BfFindTypeDefFlag_AllowGlobal) == 0)))
2698 {
2699 bool handled = false;
2700 if ((itr.mCurEntry < mTypeDefs.mPartialSkipCache.mSize) && (!allowGlobal))
2701 {
2702 auto& entry = mTypeDefs.mPartialSkipCache[itr.mCurEntry];
2703 if (entry.mRevision == mTypeDefs.mRevision)
2704 {
2705 if (entry.mIndex == -1)
2706 {
2707 // No non-partial here
2708 break;
2709 }
2710
2711 itr.mCurEntry = entry.mIndex;
2712 typeDef = *itr;
2713 handled = true;
2714 }
2715 }
2716
2717 if (!handled)

Callers 7

FindTypeMethod · 0.45
ReflectInitMethod · 0.45
CreateVDataMethod · 0.45
UpdateRevisedTypesMethod · 0.45
PopulateReifiedMethod · 0.45
DoCompileMethod · 0.45

Calls 12

GetPartsCountMethod · 0.80
TryGetValueWithMethod · 0.80
SetPartialSkipCacheMethod · 0.80
IsExtensionMethod · 0.80
SubstringMethod · 0.80
sizeMethod · 0.45
SetMethod · 0.45
TryGetMethod · 0.45
IsGlobalsContainerMethod · 0.45
MoveToNextHashMatchMethod · 0.45
IsEmptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected