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

Method CheckPropFail

IDEHelper/Compiler/BfExprEvaluator.cpp:19987–20017  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19985}
19986
19987void BfExprEvaluator::CheckPropFail(BfMethodDef* propMethodDef, BfMethodInstance* methodInstance, bool checkProt)
19988{
19989 auto propTypeInst = mPropTarget.mType->ToTypeInstance();
19990 // If mExplicitInterface is null then we are implicitly calling through an interface
19991 if ((checkProt) && (propTypeInst != NULL) && (methodInstance->GetExplicitInterface() == NULL) &&
19992 (!mModule->CheckAccessMemberProtection(propMethodDef->mProtection, propTypeInst)))
19993 mModule->Fail(StrFormat("'%s' is inaccessible due to its protection level", mModule->MethodToString(methodInstance).c_str()), mPropSrc);
19994 else if (mPropCheckedKind != methodInstance->mMethodDef->mCheckedKind)
19995 {
19996 bool passes = true;
19997 if (mPropCheckedKind != BfCheckedKind_NotSet)
19998 {
19999 passes = false;
20000 }
20001 else
20002 {
20003 auto defaultCheckedKind = mModule->GetDefaultCheckedKind();
20004 if (defaultCheckedKind != methodInstance->mMethodDef->mCheckedKind)
20005 passes = false;
20006 }
20007 if (!passes)
20008 {
20009 auto error = mModule->Fail(StrFormat("'%s' cannot be used because its 'checked' specifier does not match the requested specifier", mModule->MethodToString(methodInstance).c_str()), mPropSrc);
20010 if (error != NULL)
20011 {
20012 if ((error != NULL) && (methodInstance->mMethodDef->mMethodDeclaration != NULL))
20013 mModule->mCompiler->mPassInstance->MoreInfo(StrFormat("See method declaration"), methodInstance->mMethodDef->GetRefNode());
20014 }
20015 }
20016 }
20017}
20018
20019bool BfExprEvaluator::HasResult()
20020{

Callers

nothing calls this directly

Calls 9

GetExplicitInterfaceMethod · 0.80
MethodToStringMethod · 0.80
GetDefaultCheckedKindMethod · 0.80
MoreInfoMethod · 0.80
ToTypeInstanceMethod · 0.45
FailMethod · 0.45
c_strMethod · 0.45
GetRefNodeMethod · 0.45

Tested by

no test coverage detected