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

Method AddTypeMembers

IDEHelper/Compiler/BfAutoComplete.cpp:918–1110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

916}
917
918void BfAutoComplete::AddTypeMembers(BfTypeInstance* typeInst, bool addStatic, bool addNonStatic, const StringImpl& filter, BfTypeInstance* startType, bool allowInterfaces, bool allowImplicitThis, bool checkOuterType)
919{
920 bool isInterface = false;
921
922 if (mForceAllowNonStatic)
923 addNonStatic = true;
924
925 auto activeTypeDef = mModule->GetActiveTypeDef();
926
927#define CHECK_STATIC(staticVal) ((staticVal && addStatic) || (!staticVal && addNonStatic))
928
929 mModule->PopulateType(typeInst, BfPopulateType_Data);
930
931 if ((addStatic) && (mModule->mCurMethodInstance == NULL) && (typeInst->IsEnum()) && (allowImplicitThis))
932 {
933 AddEntry(AutoCompleteEntry("value", "_"), filter);
934 }
935
936 if ((typeInst->IsEnum()) && (typeInst->IsTypedPrimitive()))
937 {
938 if (typeInst->IsTypedPrimitive())
939 AddEntry(AutoCompleteEntry("valuetype", "UnderlyingType"), filter);
940 }
941
942 BfShow checkShow = (startType == typeInst) ? BfShow_Hide : BfShow_HideIndirect;
943
944 BfProtectionCheckFlags protectionCheckFlags = BfProtectionCheckFlag_None;
945 for (auto& fieldInst : typeInst->mFieldInstances)
946 {
947 auto fieldDef = fieldInst.GetFieldDef();
948 if (fieldDef == NULL)
949 continue;
950
951 if (fieldDef->mShow >= checkShow)
952 continue;
953
954 if ((CHECK_STATIC(fieldDef->mIsStatic)) &&
955 ((mIsGetDefinition) || (mModule->CheckProtection(protectionCheckFlags, typeInst, fieldDef->mDeclaringType->mProject, fieldDef->mProtection, startType))))
956 {
957 if ((!typeInst->IsTypeMemberIncluded(fieldDef->mDeclaringType, activeTypeDef, mModule)) ||
958 (!typeInst->IsTypeMemberAccessible(fieldDef->mDeclaringType, activeTypeDef)))
959 continue;
960
961 AddField(typeInst, fieldDef, &fieldInst, filter);
962 }
963 }
964
965 for (auto methodDef : typeInst->mTypeDef->mMethods)
966 {
967 if (methodDef->mIsOverride)
968 continue;
969 if (methodDef->mShow >= checkShow)
970 continue;
971 if (methodDef->mName.IsEmpty())
972 continue;
973
974 if (methodDef->mExplicitInterface != NULL)
975 continue;

Callers 1

VisitMethod · 0.80

Calls 15

AutoCompleteEntryClass · 0.85
GetActiveTypeDefMethod · 0.80
GetFieldDefMethod · 0.80
GetMethodDeclarationMethod · 0.80
HasExplicitInterfaceMethod · 0.80
GetOuterTypeMethod · 0.80
GetDeclaringTypeMethod · 0.80
GetUsingProtectionMethod · 0.80
PopulateTypeMethod · 0.45
IsEnumMethod · 0.45
IsTypedPrimitiveMethod · 0.45

Tested by

no test coverage detected