Logo Search packages:      
Sourcecode: ktechlab version File versions

void FlowCode::addCodeBranch ( FlowPart flowPart  ) 

Adds a code branch to the current insertion point. This will stop when the level gets below the original starting level (so for insertion of the contents of a for loop, insertion will stop at the end of that for loop).

Parameters:
flowPart The next FlowPart to get code from

Definition at line 103 of file flowcode.cpp.

References addCode(), FlowPart::generateMicrobe(), genLabel(), Item::id(), isValidBranch(), and Item::level().

Referenced by generateMicrobe(), and FlowPart::handleIfElse().

{
      if (!flowPart)
            return;
      
      if ( !isValidBranch(flowPart) )
            return;
      
      if ( m_addedParts.contains(flowPart) )
      {
            const QString labelName = genLabel(flowPart->id());
            addCode( "goto "+labelName );
            m_gotos.append(labelName);
            return;
      }
      else
      {
            m_addedParts.append(flowPart);
            int prevLevel = m_curLevel;
            m_curLevel = flowPart->level();
            
            const QString labelName = genLabel(flowPart->id());
            addCode(labelName+':');
            m_labels.append(labelName);
            
            flowPart->generateMicrobe(this);
            m_curLevel = prevLevel;
      }
}


Generated by  Doxygen 1.6.0   Back to index