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

Method WantsCheckMethod

IDEHelper/Compiler/BfExprEvaluator.cpp:1537–1574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1535}
1536
1537bool BfMethodMatcher::WantsCheckMethod(BfProtectionCheckFlags& flags, BfTypeInstance* startTypeInstance, BfTypeInstance* checkTypeInstance, BfMethodDef* checkMethod)
1538{
1539 MatchFailKind matchFailKind = MatchFailKind_None;
1540 if (!mModule->CheckProtection(flags, checkTypeInstance, checkMethod->mDeclaringType->mProject, checkMethod->mProtection, startTypeInstance))
1541 {
1542 if ((mBypassVirtual) &&
1543 ((checkMethod->mProtection == BfProtection_Protected) || (checkMethod->mProtection == BfProtection_ProtectedInternal)) &&
1544 (mModule->TypeIsSubTypeOf(mModule->mCurTypeInstance, startTypeInstance)))
1545 {
1546 // Allow explicit 'base' call
1547 }
1548 else
1549 {
1550 return false;
1551 }
1552 }
1553
1554 if (mCheckedKind != checkMethod->mCheckedKind)
1555 {
1556 bool passes = true;
1557 if (mCheckedKind != BfCheckedKind_NotSet)
1558 {
1559 passes = false;
1560 }
1561 else
1562 {
1563 auto defaultCheckedKind = mModule->GetDefaultCheckedKind();
1564 if (defaultCheckedKind != checkMethod->mCheckedKind)
1565 passes = false;
1566 }
1567 if (!passes)
1568 {
1569 return false;
1570 }
1571 }
1572
1573 return true;
1574}
1575
1576bool BfMethodMatcher::InferFromGenericConstraints(BfMethodInstance* methodInstance, BfGenericParamInstance* genericParamInst, BfTypeVector* methodGenericArgs)
1577{

Callers 1

Calls 3

GetDefaultCheckedKindMethod · 0.80
CheckProtectionMethod · 0.45
TypeIsSubTypeOfMethod · 0.45

Tested by

no test coverage detected