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

Method FailAfterAt

IDEHelper/Compiler/BfSystem.cpp:1643–1680  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1641}
1642
1643BfError* BfPassInstance::FailAfterAt(const StringImpl& error, BfSourceData* bfSource, int srcIdx)
1644{
1645 BP_ZONE("BfPassInstance::FailAfterAt");
1646
1647 mFailedIdx++;
1648 if ((int)mErrors.size() >= sMaxErrors)
1649 return NULL;
1650
1651 auto bfParser = bfSource->ToParserData();
1652 if (!WantsRangeRecorded(bfParser, srcIdx, 1, false))
1653 return NULL;
1654
1655 // Go to start of UTF8 chunk
1656// int startIdx = srcIdx;
1657// int spanLenth = 0;
1658// UTF8GetGraphemeClusterSpan(bfParser->mSrc, bfParser->mOrigSrcLength, srcIdx, startIdx, spanLenth);
1659
1660 BfError* errorVal = new BfError();
1661 errorVal->mIsWarning = false;
1662 errorVal->SetSource(this, bfSource);
1663 errorVal->mIsAfter = true;
1664 errorVal->mError = error;
1665 errorVal->mSrcStart = srcIdx;
1666 errorVal->mSrcEnd = srcIdx + 1;
1667 FixSrcStartAndEnd(bfSource, errorVal->mSrcStart, errorVal->mSrcEnd);
1668 mErrorSet.Add(BfErrorEntry(errorVal));
1669 mErrors.push_back(errorVal);
1670
1671 mLastWasDisplayed = WantsRangeDisplayed(bfParser, srcIdx - 1, 2, false);
1672 if (mLastWasDisplayed)
1673 {
1674 String errorStart = "ERROR";
1675 /*if ((int)mErrors.size() > 1)
1676 errorStart += StrFormat(" #%d", mErrors.size());*/
1677 MessageAt(":error", errorStart + ": " + error, bfParser, srcIdx + 1, 1);
1678 }
1679 return errorVal;
1680}
1681
1682BfError* BfPassInstance::Fail(const StringImpl& error)
1683{

Callers 4

CreateStatementMethod · 0.80
HandlePragmaMethod · 0.80
NextTokenMethod · 0.80
ParseBlockMethod · 0.80

Calls 6

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