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

Method FindTypeDefEx

IDEHelper/Compiler/BfSystem.cpp:2912–2956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2910}
2911
2912BfTypeDef* BfSystem::FindTypeDefEx(const StringImpl& fullTypeName)
2913{
2914 int colonPos = (int)fullTypeName.IndexOf(':');
2915 if (colonPos == -1)
2916 return NULL;
2917
2918 auto project = GetProject(fullTypeName.Substring(0, colonPos));
2919 if (project == NULL)
2920 return NULL;
2921
2922 int numGenericArgs = 0;
2923 String typeName = fullTypeName.Substring(colonPos + 1);
2924 int tildePos = (int)typeName.LastIndexOf('`');
2925 if (tildePos != -1)
2926 {
2927 BF_ASSERT(tildePos > (int)typeName.LastIndexOf('.'));
2928 numGenericArgs = atoi(typeName.c_str() + tildePos + 1);
2929 typeName.RemoveToEnd(tildePos);
2930 }
2931
2932 BfAtomComposite qualifiedFindName;
2933 BfAtom* tempData[16];
2934 qualifiedFindName.mAllocSize = 16;
2935 qualifiedFindName.mParts = tempData;
2936
2937 BfTypeDef* result = NULL;
2938 if (ParseAtomComposite(typeName, qualifiedFindName))
2939 {
2940 auto itr = mTypeDefs.TryGet(qualifiedFindName);
2941 while (itr)
2942 {
2943 BfTypeDef* typeDef = *itr;
2944 if ((typeDef->mFullName == qualifiedFindName) && (CheckTypeDefReference(typeDef, project)) &&
2945 (!typeDef->mIsPartial))
2946 {
2947 if (typeDef->mGenericParamDefs.size() == numGenericArgs)
2948 return typeDef;
2949 }
2950 itr.MoveToNextHashMatch();
2951 }
2952 }
2953 if (qualifiedFindName.mParts == tempData)
2954 qualifiedFindName.mParts = NULL;
2955 return result;
2956}
2957
2958void BfSystem::FindFixitNamespaces(const StringImpl& typeName, int numGenericArgs, BfProject* project, std::set<String>& fixitNamespaces)
2959{

Callers 1

GetSymbolReferencesMethod · 0.80

Calls 8

SubstringMethod · 0.80
IndexOfMethod · 0.45
LastIndexOfMethod · 0.45
c_strMethod · 0.45
RemoveToEndMethod · 0.45
TryGetMethod · 0.45
sizeMethod · 0.45
MoveToNextHashMatchMethod · 0.45

Tested by

no test coverage detected