| 547 | } |
| 548 | |
| 549 | void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* methodDef, BfMethodInstance* methodInstance, BfMethodDeclaration* methodDecl, const StringImpl& methodName, const StringImpl& filter) |
| 550 | { |
| 551 | int wantPrefixCount = 0; |
| 552 | const char* filterStr = filter.c_str(); |
| 553 | while (filterStr[0] == '@') |
| 554 | { |
| 555 | filterStr++; |
| 556 | wantPrefixCount++; |
| 557 | } |
| 558 | String replaceName; |
| 559 | AutoCompleteEntry entry("method", methodName, methodDef->mNamePrefixCount - wantPrefixCount); |
| 560 | if (methodDecl != NULL) |
| 561 | { |
| 562 | if (methodDecl->mMixinSpecifier != NULL) |
| 563 | { |
| 564 | replaceName = entry.mDisplay; |
| 565 | replaceName += "!"; |
| 566 | entry.mDisplay = replaceName.c_str(); |
| 567 | entry.mEntryType = "mixin"; |
| 568 | } |
| 569 | } |
| 570 | if (methodDef->mMethodType == BfMethodType_Extension) |
| 571 | entry.mEntryType = "extmethod"; |
| 572 | |
| 573 | if (auto entryAdded = AddEntry(entry, filterStr)) |
| 574 | { |
| 575 | if (methodDecl != NULL) |
| 576 | { |
| 577 | if ((methodInstance != NULL) && (methodInstance->mMethodDef->mIsLocalMethod) && (methodDecl->mReturnType != NULL) && (GetCursorIdx(methodDecl) == methodDecl->mReturnType->mSrcEnd)) |
| 578 | { |
| 579 | // This isn't really a local method decl, it just looks like one |
| 580 | return; |
| 581 | } |
| 582 | |
| 583 | if (CheckDocumentation(entryAdded, NULL)) |
| 584 | { |
| 585 | String str; |
| 586 | if ((methodInstance == NULL) && (methodDef != NULL)) |
| 587 | methodInstance = mModule->GetRawMethodInstance(typeInstance, methodDef); |
| 588 | if (methodInstance != NULL) |
| 589 | { |
| 590 | SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(mModule->mCurTypeInstance, typeInstance); |
| 591 | SetAndRestoreValue<BfMethodInstance*> prevCurMethodInstance(mModule->mCurMethodInstance, methodInstance); |
| 592 | str = mModule->MethodToString(methodInstance, (BfMethodNameFlags)(BfMethodNameFlag_IncludeReturnType | BfMethodNameFlag_ResolveGenericParamNames)); |
| 593 | } |
| 594 | |
| 595 | if (entryAdded->mDocumentation != NULL) |
| 596 | { |
| 597 | str += "\x04"; |
| 598 | str.Append(entryAdded->mDocumentation); |
| 599 | } |
| 600 | else if (methodDecl->mDocumentation != NULL) |
| 601 | { |
| 602 | if (!str.IsEmpty()) |
| 603 | str += "\x05"; |
| 604 | methodDecl->mDocumentation->GetDocString(str); |
| 605 | } |
| 606 | if (!str.IsEmpty()) |
nothing calls this directly
no test coverage detected