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

Method GetTypeDefMatches

IDEHelper/Compiler/BfCompiler.cpp:9200–9518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9198}
9199
9200String BfCompiler::GetTypeDefMatches(const StringImpl& searchStr, bool includeLocation)
9201{
9202 String result;
9203 TypeDefMatchHelper matchHelper(result);
9204
9205 int openParenIdx = -1;
9206 bool parenHasDot = false;
9207
9208 //
9209 {
9210 int searchIdx = 0;
9211 while (searchIdx < (int)searchStr.length())
9212 {
9213 int spacePos = (int)searchStr.IndexOf(' ', searchIdx);
9214 String str;
9215 if (spacePos == -1)
9216 str = searchStr.Substring(searchIdx);
9217 else
9218 str = searchStr.Substring(searchIdx, (int)(spacePos - searchIdx));
9219 str.Trim();
9220
9221 TypeDefMatchHelper::SearchEntry searchEntry;
9222
9223 for (int i = 0; i < (int)str.length(); i++)
9224 {
9225 char c = str[i];
9226 if (c == '<')
9227 {
9228 searchEntry.mGenericCount = 1;
9229 searchEntry.mStr = str.Substring(0, i);
9230 }
9231 else if (searchEntry.mGenericCount > 0)
9232 {
9233 if (c == ',')
9234 searchEntry.mGenericCount++;
9235 }
9236 }
9237 if (searchEntry.mStr.IsEmpty())
9238 searchEntry.mStr = str;
9239
9240 if (str.Contains('('))
9241 {
9242 if (str.Contains('.'))
9243 parenHasDot = true;
9244 if (openParenIdx == -1)
9245 openParenIdx = matchHelper.mSearch.mSize;
9246 }
9247
9248 if (!searchEntry.mStr.IsEmpty())
9249 matchHelper.mSearch.Add(searchEntry);
9250 if (str.Contains('.'))
9251 matchHelper.mHasDotSearch = true;
9252 if (spacePos == -1)
9253 break;
9254 searchIdx = spacePos + 1;
9255 }
9256
9257 //// We sort from longest to shortest to make sure longer strings match before shorter, which

Calls 15

TypeToStringFunction · 0.85
StringViewClass · 0.85
SubstringMethod · 0.80
CheckMatchMethod · 0.80
IsFullMatchMethod · 0.80
CheckMemberMatchMethod · 0.80
AddFieldDefMethod · 0.80
AddPropertyDefMethod · 0.80
GetMethodDefStringMethod · 0.80
GetGenericStrMethod · 0.80
AddMethodDefMethod · 0.80
MergeFlagsMethod · 0.80

Tested by

no test coverage detected