summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2023-04-19 10:47:23 +0200
committerLuca Di Sera <luca.disera@qt.io>2023-04-21 20:57:56 +0200
commit625289dcc8926f532b9032109574904cf6a2c18b (patch)
tree73ae1db72f1f613ee58afc55758ba7dc42505186
parent00ff2b06a17e90921d79831a62e95eecf8c6954a (diff)
downloadqttools-625289dcc8926f532b9032109574904cf6a2c18b.tar.gz
QDoc: Flatten DocParser::enterPara()
The entire method sits behind an `if`. Inverse the logic of the conditional and return early. This allows for flattening the whole method. Change-Id: I611a69bfd8850ff59e726b10d22801a3fac0527f Reviewed-by: Luca Di Sera <luca.disera@qt.io>
-rw-r--r--src/qdoc/qdoc/docparser.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/qdoc/qdoc/docparser.cpp b/src/qdoc/qdoc/docparser.cpp
index 6702d8ed2..9c6492973 100644
--- a/src/qdoc/qdoc/docparser.cpp
+++ b/src/qdoc/qdoc/docparser.cpp
@@ -1760,26 +1760,26 @@ void DocParser::appendToCode(const QString &markedCode, Atom::AtomType defaultTy
void DocParser::enterPara(Atom::AtomType leftType, Atom::AtomType rightType, const QString &string)
{
- if (m_paragraphState == OutsideParagraph) {
+ if (m_paragraphState != OutsideParagraph)
+ return;
- if ((m_private->m_text.lastAtom()->type() != Atom::ListItemLeft)
- && (m_private->m_text.lastAtom()->type() != Atom::DivLeft)
- && (m_private->m_text.lastAtom()->type() != Atom::DetailsLeft)) {
- leaveValueList();
- }
+ if ((m_private->m_text.lastAtom()->type() != Atom::ListItemLeft)
+ && (m_private->m_text.lastAtom()->type() != Atom::DivLeft)
+ && (m_private->m_text.lastAtom()->type() != Atom::DetailsLeft)) {
+ leaveValueList();
+ }
- append(leftType, string);
- m_indexStartedParagraph = false;
- m_pendingParagraphLeftType = leftType;
- m_pendingParagraphRightType = rightType;
- m_pendingParagraphString = string;
- if (leftType == Atom::SectionHeadingLeft) {
- m_paragraphState = InSingleLineParagraph;
- } else {
- m_paragraphState = InMultiLineParagraph;
- }
- skipSpacesOrOneEndl();
+ append(leftType, string);
+ m_indexStartedParagraph = false;
+ m_pendingParagraphLeftType = leftType;
+ m_pendingParagraphRightType = rightType;
+ m_pendingParagraphString = string;
+ if (leftType == Atom::SectionHeadingLeft) {
+ m_paragraphState = InSingleLineParagraph;
+ } else {
+ m_paragraphState = InMultiLineParagraph;
}
+ skipSpacesOrOneEndl();
}
void DocParser::leavePara()