diff options
author | Paul Wicking <paul.wicking@qt.io> | 2023-04-19 10:47:23 +0200 |
---|---|---|
committer | Luca Di Sera <luca.disera@qt.io> | 2023-04-21 20:57:56 +0200 |
commit | 625289dcc8926f532b9032109574904cf6a2c18b (patch) | |
tree | 73ae1db72f1f613ee58afc55758ba7dc42505186 | |
parent | 00ff2b06a17e90921d79831a62e95eecf8c6954a (diff) | |
download | qttools-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.cpp | 34 |
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() |