| 3393 | } |
| 3394 | |
| 3395 | BfError* 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 |
no test coverage detected