CppEditor: Add soft assert for unexpected semantic highlighter state

Task-number: QTCREATORBUG-28507
Change-Id: I322c9b806c85d2a013c4014c80f4ca11ca117752
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2023-01-09 15:34:55 +01:00
parent f5e4b7bd9f
commit b6bd59fc57

View File

@@ -175,9 +175,12 @@ void SemanticHighlighter::onHighlighterResultAvailable(int from, int to)
const QTextBlock lastBlockForResult = m_baseTextDocument->document()
->findBlock(endRange);
const QTextBlock endBlock = lastBlockForResult.next();
for (QTextBlock block = firstBlockForResult;
block.isValid() && block != endBlock;
block = block.next()) {
for (QTextBlock block = firstBlockForResult; block != endBlock; block = block.next()) {
QTC_ASSERT(block.isValid(),
qDebug() << from << to << i << result.line << result.column
<< firstBlockForResult.blockNumber() << firstBlockForResult.position()
<< lastBlockForResult.blockNumber() << lastBlockForResult.position();
break);
Parentheses syntacticParens = getClearedParentheses(block);
// Remove mis-detected parentheses inserted by syntactic highlighter.