File indexing completed on 2024-05-12 04:37:43
0001 /* 0002 SPDX-FileCopyrightText: 2010 Aleix Pol Gonzalez <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-only 0005 */ 0006 0007 #include "controlflownode.h" 0008 0009 using namespace KDevelop; 0010 0011 ControlFlowNode::ControlFlowNode() 0012 : m_conditionRange(RangeInRevision::invalid()) 0013 {} 0014 0015 ControlFlowNode::Type ControlFlowNode::type() const 0016 { 0017 Q_ASSERT(!m_alternative || m_next); //If we have alternative, we have next. 0018 0019 if (m_next && m_alternative) 0020 return Conditional; 0021 else if (m_next) 0022 return Sequential; 0023 else 0024 return Exit; 0025 } 0026 0027 void ControlFlowNode::setConditionRange(const RangeInRevision& range) 0028 { 0029 Q_ASSERT(!range.isValid() || range.end >= range.start); 0030 m_conditionRange = range; 0031 } 0032 0033 void ControlFlowNode::setStartCursor(const CursorInRevision& cursor) 0034 { 0035 m_nodeRange.start = cursor; 0036 } 0037 0038 void ControlFlowNode::setEndCursor(const CursorInRevision& cursor) 0039 { 0040 m_nodeRange.end = cursor; 0041 } 0042 0043 void ControlFlowNode::setNext(ControlFlowNode* next) 0044 { 0045 m_next = next; 0046 } 0047 0048 void ControlFlowNode::setAlternative(ControlFlowNode* alt) 0049 { 0050 m_alternative = alt; 0051 } 0052 0053 ControlFlowNode* ControlFlowNode::next() const 0054 { 0055 return m_next; 0056 } 0057 0058 ControlFlowNode* ControlFlowNode::alternative() const 0059 { 0060 return m_alternative; 0061 } 0062 0063 RangeInRevision ControlFlowNode::nodeRange() const 0064 { 0065 return m_nodeRange; 0066 } 0067 0068 RangeInRevision ControlFlowNode::conditionRange() const 0069 { 0070 return m_conditionRange; 0071 }