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

Method WarnAt

IDEHelper/Compiler/BfSystem.cpp:1789–1835  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1787}
1788
1789BfError* BfPassInstance::WarnAt(int warningNumber, const StringImpl& warning, BfSourceData* bfSource, int srcIdx, int srcLen, bool isDeferred)
1790{
1791 mLastWasAdded = false;
1792 if ((int) mErrors.size() >= sMaxErrors)
1793 return NULL;
1794
1795 auto bfParser = bfSource->ToParserData();
1796 if ((bfParser != NULL) && (!bfParser->IsWarningEnabledAtSrcIndex(warningNumber, srcIdx)))
1797 return NULL;
1798
1799 if (!WantsRangeRecorded(bfParser, srcIdx, srcLen, true, isDeferred))
1800 return NULL;
1801
1802 mWarnIdx++;
1803
1804 TrimSourceRange(bfSource, srcIdx, srcLen);
1805
1806 BfError* errorVal = new BfError();
1807 errorVal->mIsWarning = true;
1808 errorVal->mWarningNumber = warningNumber;
1809 errorVal->SetSource(this, bfSource);
1810 errorVal->mIsAfter = false;
1811 errorVal->mError = warning;
1812 errorVal->mSrcStart = srcIdx;
1813 errorVal->mSrcEnd = srcIdx + srcLen;
1814 errorVal->mIsDeferred = isDeferred;
1815 FixSrcStartAndEnd(bfSource, errorVal->mSrcStart, errorVal->mSrcEnd);
1816 mErrorSet.Add(BfErrorEntry(errorVal));
1817 mErrors.push_back(errorVal);
1818 ++mWarningCount;
1819 mLastWasAdded = true;
1820
1821 if (!isDeferred)
1822 {
1823 mLastWasDisplayed = WantsRangeDisplayed(bfParser, srcIdx, srcLen, true);
1824 if (mLastWasDisplayed)
1825 {
1826 String errorStart = "WARNING";
1827 if ((int)mErrors.size() > 1)
1828 errorStart += StrFormat("(%d)", mErrors.size());
1829 if (warningNumber > 0)
1830 errorStart += StrFormat(": BF%04d", warningNumber);
1831 MessageAt(":warn", errorStart + ": " + warning, bfParser, srcIdx);
1832 }
1833 }
1834 return errorVal;
1835}
1836
1837BfError* BfPassInstance::Warn(int warningNumber, const StringImpl& warning)
1838{

Callers 3

WarnMethod · 0.80
HandlePreprocessorMethod · 0.80
NextTokenMethod · 0.80

Calls 7

BfErrorEntryClass · 0.85
sizeMethod · 0.45
ToParserDataMethod · 0.45
SetSourceMethod · 0.45
AddMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected