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

Method CheckOuterTypeStaticMethods

IDEHelper/Compiler/BfExprEvaluator.cpp:3259–3322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3257}
3258
3259void BfMethodMatcher::CheckOuterTypeStaticMethods(BfTypeInstance* typeInstance, bool isFailurePass)
3260{
3261 bool allowPrivate = true;
3262 bool allowProtected = true;
3263
3264 auto curTypeInst = typeInstance;
3265 auto curTypeDef = typeInstance->mTypeDef;
3266
3267 while (true)
3268 {
3269 curTypeDef->PopulateMemberSets();
3270 BfMethodDef* nextMethodDef = NULL;
3271 BfMemberSetEntry* entry;
3272 if (curTypeDef->mMethodSet.TryGetWith(mMethodName, &entry))
3273 nextMethodDef = (BfMethodDef*)entry->mMemberDef;
3274
3275 while (nextMethodDef != NULL)
3276 {
3277 auto checkMethod = nextMethodDef;
3278 nextMethodDef = nextMethodDef->mNextWithSameName;
3279
3280 // These can only be invoked when the target itself is the interface
3281 if (checkMethod->mExplicitInterface != NULL)
3282 continue;
3283 if ((checkMethod->mMethodType != mMethodType) || (!checkMethod->mIsStatic))
3284 continue;
3285 if (checkMethod->mName != mMethodName)
3286 continue;
3287
3288 if ((!isFailurePass) && (!mModule->CheckProtection(checkMethod->mProtection, NULL, allowProtected, allowPrivate)))
3289 continue;
3290
3291 CheckMethod(typeInstance, curTypeInst, checkMethod, isFailurePass);
3292 }
3293
3294 if (mBestMethodDef != NULL)
3295 return;
3296
3297 auto baseType = curTypeInst->mBaseType;
3298 if (baseType == NULL)
3299 break;
3300 curTypeDef = baseType->mTypeDef;
3301 curTypeInst = baseType;
3302
3303 allowPrivate = false;
3304
3305 if ((isFailurePass) && (mBackupMethodDef != NULL))
3306 break;
3307 }
3308
3309 if (mBestMethodDef == NULL)
3310 {
3311 // FAILED, but select the first method which will fire an actual error on param type matching
3312 mBestMethodDef = mBackupMethodDef;
3313 }
3314
3315 if (mBestMethodDef == NULL)
3316 {

Callers

nothing calls this directly

Calls 4

PopulateMemberSetsMethod · 0.80
TryGetWithMethod · 0.80
GetOuterTypeMethod · 0.80
CheckProtectionMethod · 0.45

Tested by

no test coverage detected