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

Method Fail

IDEHelper/Compiler/BfModule.cpp:3234–3370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3232}
3233
3234BfError* BfModule::Fail(const StringImpl& error, BfAstNode* refNode, bool isPersistent, bool deferError)
3235{
3236 BP_ZONE("BfModule::Fail");
3237
3238 if (mIgnoreErrors)
3239 {
3240 mHadIgnoredError = true;
3241 if (mAttributeState != NULL)
3242 mAttributeState->mFlags = (BfAttributeState::Flags)(mAttributeState->mFlags | BfAttributeState::Flag_HadError);
3243 return NULL;
3244 }
3245
3246 if (!mReportErrors)
3247 {
3248 mCompiler->mPassInstance->SilentFail();
3249 return NULL;
3250 }
3251
3252 if (refNode != NULL)
3253 refNode = BfNodeToNonTemporary(refNode);
3254
3255 //BF_ASSERT(refNode != NULL);
3256
3257 if (mIsComptimeModule)
3258 {
3259 if (auto ceDbgState = GetCeDbgState())
3260 {
3261 // Follow normal fail path
3262 }
3263 else
3264 {
3265 mHadBuildError = true;
3266
3267 if ((mCompiler->mCeMachine->mCurContext != NULL) && (mCompiler->mCeMachine->mCurContext->mCurCallSource != NULL) &&
3268 (mCompiler->mCeMachine->mCurContext->mCurCallSource->mRefNode != NULL))
3269 {
3270 BfError* bfError = mCompiler->mPassInstance->Fail("Comptime method generation had errors",
3271 mCompiler->mCeMachine->mCurContext->mCurCallSource->mRefNode);
3272 if (bfError != NULL)
3273 mCompiler->mPassInstance->MoreInfo(error, refNode);
3274 return bfError;
3275 }
3276
3277 return NULL;
3278 }
3279 }
3280
3281 if ((mCurMethodState != NULL) && (mCurMethodState->mConstResolveState != NULL) && (mCurMethodState->mConstResolveState->mInCalcAppend))
3282 {
3283 mCurMethodState->mConstResolveState->mFailed = true;
3284 return NULL;
3285 }
3286
3287 if (mCurMethodInstance != NULL)
3288 mCurMethodInstance->mHasFailed = true;
3289
3290 if ((mCurTypeInstance != NULL) && (mCurTypeInstance->IsUnspecializedTypeVariation()))
3291 return NULL;

Callers 15

FinishMethod · 0.45
DoObjectCreateMethod · 0.45
ResolveVarFieldTypeMethod · 0.45
SlotVirtualMethodMethod · 0.45
DoPopulateTypeMethod · 0.45
ProcessErrorsMethod · 0.45
VerifyIsStatementMethod · 0.45
CheckAllowValueMethod · 0.45
ResolveMethod · 0.45
GetTestMethodsMethod · 0.45

Calls 8

SilentFailMethod · 0.80
MoreInfoMethod · 0.80
LocationToStringMethod · 0.80
GetRootMixinStateMethod · 0.80
DeferFailMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected