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

Method AddSelfResultTypeMembers

IDEHelper/Compiler/BfAutoComplete.cpp:1112–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112void BfAutoComplete::AddSelfResultTypeMembers(BfTypeInstance* typeInst, BfTypeInstance* selfType, const StringImpl& filter, bool allowPrivate)
1113{
1114 bool isInterface = false;
1115 bool allowProtected = allowPrivate;
1116
1117 auto activeTypeDef = mModule->GetActiveTypeDef();
1118
1119 mModule->PopulateType(typeInst, BfPopulateType_Data);
1120
1121 BfShow checkShow = allowPrivate ? BfShow_Hide : BfShow_HideIndirect;
1122
1123 for (auto& fieldInst : typeInst->mFieldInstances)
1124 {
1125 auto fieldDef = fieldInst.GetFieldDef();
1126 if (fieldDef == NULL)
1127 continue;
1128
1129 if (fieldDef->mShow > checkShow)
1130 continue;
1131
1132 if ((fieldDef->mIsStatic) && (CheckProtection(fieldDef->mProtection, fieldDef->mDeclaringType, allowProtected, allowPrivate)))
1133 {
1134 if (!mModule->CanCast(BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), fieldInst.mResolvedType), selfType))
1135 continue;
1136
1137 if ((!typeInst->IsTypeMemberIncluded(fieldDef->mDeclaringType, activeTypeDef, mModule)) ||
1138 (!typeInst->IsTypeMemberAccessible(fieldDef->mDeclaringType, activeTypeDef)))
1139 continue;
1140
1141 AddField(typeInst, fieldDef, &fieldInst, filter);
1142 }
1143 }
1144
1145 for (auto methodDef : typeInst->mTypeDef->mMethods)
1146 {
1147 if (methodDef->mIsOverride)
1148 continue;
1149 if (methodDef->mShow > checkShow)
1150 continue;
1151 if (methodDef->mName.IsEmpty())
1152 continue;
1153
1154 if (methodDef->mExplicitInterface != NULL)
1155 continue;
1156 if ((!typeInst->IsTypeMemberIncluded(methodDef->mDeclaringType, activeTypeDef, mModule)) ||
1157 (!typeInst->IsTypeMemberAccessible(methodDef->mDeclaringType, activeTypeDef)))
1158 continue;
1159
1160 if (!methodDef->mIsStatic)
1161 continue;
1162
1163 bool canUseMethod;
1164 canUseMethod = (methodDef->mMethodType == BfMethodType_Normal) || (methodDef->mMethodType == BfMethodType_Mixin);
1165 canUseMethod &= CheckProtection(methodDef->mProtection, methodDef->mDeclaringType, allowProtected, allowPrivate);
1166
1167 if (methodDef->mMethodType != BfMethodType_Normal)
1168 continue;
1169

Callers 2

DoInvocationMethod · 0.80
DoMemberReferenceMethod · 0.80

Calls 15

CheckProtectionFunction · 0.85
BfTypedValueClass · 0.85
GetActiveTypeDefMethod · 0.80
GetFieldDefMethod · 0.80
GetFakeValMethod · 0.80
GetMethodDeclarationMethod · 0.80
HasExplicitInterfaceMethod · 0.80
GetOuterTypeMethod · 0.80
PopulateTypeMethod · 0.45
CanCastMethod · 0.45
IsTypeMemberIncludedMethod · 0.45

Tested by

no test coverage detected