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

Method GetTypeDefs

IDEHelper/Compiler/BfCompiler.cpp:9520–9598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9518}
9519
9520void BfCompiler::GetTypeDefs(const StringImpl& inTypeName, Array<BfTypeDef*>& typeDefs)
9521{
9522 BfProject* project = NULL;
9523 int idx = 0;
9524
9525 int sep = (int)inTypeName.LastIndexOf(':');
9526 if (sep != -1)
9527 {
9528 int startProjName = (int)inTypeName.LastIndexOf(':', sep - 1) + 1;
9529
9530 idx = sep + 1;
9531 project = mSystem->GetProject(inTypeName.Substring(startProjName, sep - startProjName));
9532 }
9533
9534 String typeName;
9535 int genericCount = 0;
9536 int pendingGenericCount = 0;
9537 for (; idx < (int)inTypeName.length(); idx++)
9538 {
9539 char c = inTypeName[idx];
9540 if (c == '<')
9541 genericCount = 1;
9542 else if (genericCount > 0)
9543 {
9544 if (c == ',')
9545 genericCount++;
9546 else if (c == '>')
9547 {
9548 pendingGenericCount = genericCount;
9549 genericCount = 0;
9550 }
9551 }
9552 else
9553 {
9554 if (pendingGenericCount != 0)
9555 {
9556 typeName += StrFormat("`%d", pendingGenericCount);
9557 pendingGenericCount = 0;
9558 }
9559 typeName += c;
9560 }
9561 }
9562
9563 bool isGlobals = false;
9564 if (typeName == ":static")
9565 {
9566 typeName.clear();
9567 isGlobals = true;
9568 }
9569 if (typeName.EndsWith(".:static"))
9570 {
9571 typeName.RemoveToEnd(typeName.length() - 8);
9572 isGlobals = true;
9573 }
9574
9575 for (int i = 0; i < (int)typeName.length(); i++)
9576 if (typeName[i] == '+')
9577 typeName[i] = '.';

Callers

nothing calls this directly

Calls 14

GetProjectMethod · 0.80
SubstringMethod · 0.80
ParseAtomCompositeMethod · 0.80
LastIndexOfMethod · 0.45
lengthMethod · 0.45
clearMethod · 0.45
EndsWithMethod · 0.45
RemoveToEndMethod · 0.45
IsEmptyMethod · 0.45
TryGetMethod · 0.45
IsGlobalsContainerMethod · 0.45

Tested by

no test coverage detected