private void ExtractIfNext(If check, Statement next) { Statement last1 = check.IfBody.GetLast(); if (last1 is If) { ExtractIfNext(last1 as If, next); } else { NextTable.SetNext(last1, next); } if (check.ElseBody != null) { Statement last2 = check.ElseBody.GetLast(); if (last2 is If) { ExtractIfNext(last2 as If, next); } else { NextTable.SetNext(last2, next); } } }
private void ExtractWhile(While loop, Procedure procedureContext) { ExtractVariable(loop.Condition); Variable retrievedVariable = Variables.GetVariableByName(loop.Condition.Name); UsesTable.SetUses(loop, retrievedVariable); ExtractBody(loop, loop.Body, procedureContext); NextTable.SetNext(loop, loop.Body.GetFirst()); if (loop.Body.GetLast() is If) { ExtractIfNext(loop.Body.GetLast() as If, loop); } else { NextTable.SetNext(loop.Body.GetLast(), loop); } }