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

Method Warn

IDEHelper/Compiler/BfModule.cpp:3395–3496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3393}
3394
3395BfError* BfModule::Warn(int warningNum, const StringImpl& warning, BfAstNode* refNode, bool isPersistent, bool showInSpecialized)
3396{
3397 if (mIgnoreErrors || mIgnoreWarnings)
3398 return NULL;
3399
3400 if (!mReportErrors)
3401 {
3402 mCompiler->mPassInstance->SilentFail();
3403 return NULL;
3404 }
3405
3406 BfAstNode* unwarnNode = refNode;
3407 //
3408 {
3409 BfParentNodeEntry* parentNodeEntry = mParentNodeEntry;
3410 while (parentNodeEntry != NULL)
3411 {
3412 if (auto block = BfNodeDynCast<BfBlock>(parentNodeEntry->mNode))
3413 break;
3414 unwarnNode = parentNodeEntry->mNode;
3415 parentNodeEntry = parentNodeEntry->mPrev;
3416 }
3417 }
3418 auto parser = unwarnNode->GetSourceData()->ToParserData();
3419 if ((parser != NULL) && (parser->IsUnwarnedAt(unwarnNode)))
3420 {
3421 return NULL;
3422 }
3423
3424 // Right now we're only warning on the unspecialized declarations, we may revisit this
3425 if (mCurMethodInstance != NULL)
3426 {
3427 if (mCurMethodInstance->IsSpecializedGenericMethodOrType())
3428 {
3429 if (!showInSpecialized)
3430 return NULL;
3431 }
3432 if (mCurMethodInstance->mMethodDef->mMethodType == BfMethodType_CtorCalcAppend)
3433 return NULL; // No ctorCalcAppend warnings
3434 }
3435 if ((mCurTypeInstance != NULL) && (mCurTypeInstance->IsSpecializedType()))
3436 {
3437 if (!showInSpecialized)
3438 return NULL;
3439 }
3440
3441 if (refNode != NULL)
3442 refNode = BfNodeToNonTemporary(refNode);
3443
3444 String warningString = warning;
3445 BfWhileSpecializingFlags isWhileSpecializing = BfWhileSpecializingFlag_None;
3446 if (!AddErrorContext(warningString, refNode, isWhileSpecializing, true))
3447 return NULL;
3448 bool deferWarning = isWhileSpecializing != BfWhileSpecializingFlag_None;
3449
3450 if ((mCurMethodState != NULL) && (mCurMethodState->mMixinState != NULL))
3451 {
3452 // We used to bubble up warnings into the mixin injection site, BUT

Callers 15

UpdateRevisedTypesMethod · 0.45
DoCreateStatementMethod · 0.45
ParseMethod · 0.45
ParseGenericParamsMethod · 0.45
VisitMethod · 0.45
FlushAmbiguityErrorMethod · 0.45
VisitMethod · 0.45
CreateCallMethod · 0.45
MatchMethodMethod · 0.45
GetLambdaInstanceMethod · 0.45
CreateObjectMethod · 0.45

Calls 15

FindLineStartBeforeFunction · 0.85
AutoCompleteEntryClass · 0.85
SilentFailMethod · 0.80
GetSourceDataMethod · 0.80
IsUnwarnedAtMethod · 0.80
MoreInfoMethod · 0.80
WarnAtMethod · 0.80
IsAutocompleteMethod · 0.80
CheckFixitMethod · 0.80
AddEntryMethod · 0.80
ToParserDataMethod · 0.45

Tested by

no test coverage detected