| 1270 | } |
| 1271 | |
| 1272 | void BfAutoComplete::AddEnumTypeMembers(BfTypeInstance* typeInst, const StringImpl& filter, bool allowProtected, bool allowPrivate) |
| 1273 | { |
| 1274 | mModule->PopulateType(typeInst, BfPopulateType_Data); |
| 1275 | |
| 1276 | auto activeTypeDef = mModule->GetActiveTypeDef(); |
| 1277 | |
| 1278 | for (auto& fieldInst : typeInst->mFieldInstances) |
| 1279 | { |
| 1280 | auto fieldDef = fieldInst.GetFieldDef(); |
| 1281 | if ((fieldDef != NULL) && (fieldDef->mIsConst) && |
| 1282 | ((fieldInst.mResolvedType == typeInst) || (fieldInst.mIsEnumPayloadCase)) && |
| 1283 | (CheckProtection(fieldDef->mProtection, fieldDef->mDeclaringType, allowProtected, allowPrivate))) |
| 1284 | { |
| 1285 | if ((!typeInst->IsTypeMemberIncluded(fieldDef->mDeclaringType, activeTypeDef, mModule)) || |
| 1286 | (!typeInst->IsTypeMemberAccessible(fieldDef->mDeclaringType, activeTypeDef))) |
| 1287 | continue; |
| 1288 | |
| 1289 | bool hasPayload = false; |
| 1290 | if ((fieldInst.mIsEnumPayloadCase) && (fieldInst.mResolvedType->IsTuple())) |
| 1291 | { |
| 1292 | auto payloadType = (BfTypeInstance*)fieldInst.mResolvedType; |
| 1293 | if (!payloadType->mFieldInstances.empty()) |
| 1294 | hasPayload = true; |
| 1295 | } |
| 1296 | |
| 1297 | AutoCompleteEntry entry(hasPayload ? "payloadEnum" : "value", fieldDef->mName); |
| 1298 | if (auto entryAdded = AddEntry(entry, filter)) |
| 1299 | { |
| 1300 | auto fieldDecl = fieldDef->GetFieldDeclaration(); |
| 1301 | if (fieldDecl == NULL) |
| 1302 | continue; |
| 1303 | |
| 1304 | if (CheckDocumentation(entryAdded, fieldDecl->mDocumentation)) |
| 1305 | { |
| 1306 | } |
| 1307 | |
| 1308 | if (mIsGetDefinition) |
| 1309 | { |
| 1310 | mDefType = typeInst->mTypeDef; |
| 1311 | mDefField = fieldDef; |
| 1312 | if (fieldDecl != NULL) |
| 1313 | SetDefinitionLocation(fieldDecl->mNameNode); |
| 1314 | } |
| 1315 | } |
| 1316 | } |
| 1317 | } |
| 1318 | } |
| 1319 | |
| 1320 | void BfAutoComplete::AddExtensionMethods(BfTypeInstance* targetType, BfTypeInstance* extensionContainer, const StringImpl & filter, bool allowProtected, bool allowPrivate) |
| 1321 | { |
no test coverage detected