mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-22 01:37:59 +02:00
Allow some cases of uninitialized parsers
This commit is contained in:
parent
931e29a1f3
commit
8163d5b647
2 changed files with 68 additions and 56 deletions
|
@ -9824,6 +9824,8 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
||||||
BfPreprocessorNode* prevPreprocessorNode = NULL;
|
BfPreprocessorNode* prevPreprocessorNode = NULL;
|
||||||
int ignoredSectionStart = -1;
|
int ignoredSectionStart = -1;
|
||||||
|
|
||||||
|
if (bfParser->mSidechannelRootNode != NULL)
|
||||||
|
{
|
||||||
for (auto element : bfParser->mSidechannelRootNode->mChildArr)
|
for (auto element : bfParser->mSidechannelRootNode->mChildArr)
|
||||||
{
|
{
|
||||||
if (auto preprocessorNode = BfNodeDynCast<BfPreprocessorNode>(element))
|
if (auto preprocessorNode = BfNodeDynCast<BfPreprocessorNode>(element))
|
||||||
|
@ -9884,6 +9886,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
||||||
collapseVisitor.UpdateSeries(commentNode, 'C');
|
collapseVisitor.UpdateSeries(commentNode, 'C');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
collapseVisitor.FlushSeries();
|
collapseVisitor.FlushSeries();
|
||||||
|
|
||||||
|
@ -10063,7 +10066,12 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
||||||
int endLineChar = 0;
|
int endLineChar = 0;
|
||||||
if (srcEnd >= 0)
|
if (srcEnd >= 0)
|
||||||
emitParser->GetLineCharAtIdx(srcEnd, endLine, endLineChar);
|
emitParser->GetLineCharAtIdx(srcEnd, endLine, endLineChar);
|
||||||
outString += StrFormat("e%d,%d,%d,%d,%d\n", embedId, charIdx, startLine, endLine + 1, typeInst->mTypeDef->mTypeDeclaration->GetParser()->mTextVersion);
|
|
||||||
|
int textVersion = -1;
|
||||||
|
auto declParser = typeInst->mTypeDef->mTypeDeclaration->GetParser();
|
||||||
|
if (declParser != NULL)
|
||||||
|
textVersion = declParser->mTextVersion;
|
||||||
|
outString += StrFormat("e%d,%d,%d,%d,%d\n", embedId, charIdx, startLine, endLine + 1, textVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -404,7 +404,11 @@ BfParser::~BfParser()
|
||||||
{
|
{
|
||||||
int parserCount = gParserCount--;
|
int parserCount = gParserCount--;
|
||||||
|
|
||||||
if (mParserData->mRefCount == -1)
|
if (mParserData == NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (mParserData->mRefCount == -1)
|
||||||
{
|
{
|
||||||
// Owned data, never intended for cache
|
// Owned data, never intended for cache
|
||||||
mParserData->mSrc = NULL; // Count on BfSource dtor to release strc
|
mParserData->mSrc = NULL; // Count on BfSource dtor to release strc
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue