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

Method WarnAfterAt

IDEHelper/Compiler/BfSystem.cpp:1890–1930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1888}
1889
1890BfError* BfPassInstance::WarnAfterAt(int warningNumber, const StringImpl& error, BfSourceData* bfSource, int srcIdx)
1891{
1892 BP_ZONE("BfPassInstance::FailAfterAt");
1893
1894 mFailedIdx++;
1895 if ((int)mErrors.size() >= sMaxErrors)
1896 return NULL;
1897
1898 auto bfParser = bfSource->ToParserData();
1899 if ((bfParser != NULL) && (warningNumber > 0) && (!bfParser->IsWarningEnabledAtSrcIndex(warningNumber, srcIdx)))
1900 return NULL;
1901
1902 if (!WantsRangeRecorded(bfParser, srcIdx, 1, false))
1903 return NULL;
1904
1905 // Go to start of UTF8 chunk
1906// int startIdx = srcIdx;
1907// int spanLenth = 0;
1908// UTF8GetGraphemeClusterSpan(bfParser->mSrc, bfParser->mOrigSrcLength, srcIdx, startIdx, spanLenth);
1909
1910 BfError* errorVal = new BfError();
1911 errorVal->mIsWarning = true;
1912 errorVal->SetSource(this, bfSource);
1913 errorVal->mIsAfter = true;
1914 errorVal->mError = error;
1915 errorVal->mSrcStart = srcIdx;
1916 errorVal->mSrcEnd = srcIdx + 1;
1917 FixSrcStartAndEnd(bfSource, errorVal->mSrcStart, errorVal->mSrcEnd);
1918 mErrorSet.Add(BfErrorEntry(errorVal));
1919 mErrors.push_back(errorVal);
1920
1921 mLastWasDisplayed = WantsRangeDisplayed(bfParser, srcIdx - 1, 2, false);
1922 if (mLastWasDisplayed)
1923 {
1924 String errorStart = "WARNING";
1925 /*if ((int)mErrors.size() > 1)
1926 errorStart += StrFormat(" #%d", mErrors.size());*/
1927 MessageAt(":warn", errorStart + ": " + error, bfParser, srcIdx + 1, 1);
1928 }
1929 return errorVal;
1930}
1931
1932BfMoreInfo* BfPassInstance::MoreInfoAt(const StringImpl& info, BfSourceData* bfSource, int srcIdx, int srcLen, BfFailFlags flags)
1933{

Callers 1

CreateStatementMethod · 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