| 781 | } |
| 782 | |
| 783 | void BfAutoComplete::AddField(BfTypeInstance* typeInst, BfFieldDef* fieldDef, BfFieldInstance* fieldInstance, const StringImpl& filter) |
| 784 | { |
| 785 | if (fieldDef->mName.IsEmpty()) |
| 786 | return; |
| 787 | int wantPrefixCount = 0; |
| 788 | const char* filterStr = filter.c_str(); |
| 789 | while (filterStr[0] == '@') |
| 790 | { |
| 791 | filterStr++; |
| 792 | wantPrefixCount++; |
| 793 | } |
| 794 | AutoCompleteEntry entry(GetTypeName(fieldInstance->mResolvedType), fieldDef->mName, fieldDef->mNamePrefixCount - wantPrefixCount); |
| 795 | if (auto entryAdded = AddEntry(entry, filterStr)) |
| 796 | { |
| 797 | auto fieldDecl = fieldDef->GetFieldDeclaration(); |
| 798 | auto documentation = (fieldDecl != NULL) ? fieldDecl->mDocumentation : NULL; |
| 799 | if (CheckDocumentation(entryAdded, documentation)) |
| 800 | { |
| 801 | mModule->PopulateType(typeInst); |
| 802 | |
| 803 | bool isTag = typeInst->IsEnum() && typeInst->IsOnDemand(); |
| 804 | |
| 805 | String str; |
| 806 | if (!isTag) |
| 807 | { |
| 808 | if (!fieldInstance->GetFieldDef()->IsEnumCaseEntry()) |
| 809 | { |
| 810 | str += mModule->TypeToString(fieldInstance->mResolvedType); |
| 811 | str += " "; |
| 812 | } |
| 813 | str += mModule->TypeToString(typeInst); |
| 814 | str += "."; |
| 815 | str += fieldDef->mName; |
| 816 | } |
| 817 | |
| 818 | if (entryAdded->mDocumentation != NULL) |
| 819 | { |
| 820 | str += "\x04"; |
| 821 | str.Append(entryAdded->mDocumentation); |
| 822 | } |
| 823 | else if (documentation != NULL) |
| 824 | { |
| 825 | str += "\x05"; |
| 826 | documentation->GetDocString(str); |
| 827 | } |
| 828 | |
| 829 | if (!str.IsEmpty()) |
| 830 | entryAdded->mDocumentation = mAlloc.AllocString(str); |
| 831 | } |
| 832 | |
| 833 | if ((mIsGetDefinition) && (mDefType == NULL)) |
| 834 | { |
| 835 | mDefType = typeInst->mTypeDef; |
| 836 | mDefField = fieldDef; |
| 837 | if (auto nameNode = fieldDef->GetNameNode()) |
| 838 | SetDefinitionLocation(nameNode); |
| 839 | } |
| 840 | } |
nothing calls this directly
no test coverage detected