public SteIfElseIfElse IfElseIf(IEnumerable <SteIf> ifList) { var item = new SteIfElseIfElse(); item.IfList.AddRange(ifList); return(item); }
public SteIfElseIfElse IfElseIfElse(IEnumerable <SteIf> ifList, ISyntaxTreeElement elseCode) { var item = new SteIfElseIfElse() { ElseCode = elseCode }; item.IfList.AddRange(ifList); return(item); }
public void Visit(SteIfElseIfElse code) { var flag = false; foreach (var item in code.IfList) { if (flag == false) { TextComposer.AppendAtNewLine("if ("); flag = true; } else { TextComposer.AppendAtNewLine("else if ("); } item.Condition.AcceptVisitor(this); TextComposer .AppendLine(")") .AppendLine("{") .IncreaseIndentation(); item.TrueCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); } if (code.ElseCode == null) { return; } TextComposer.AppendLine("else") .AppendLine("{") .IncreaseIndentation(); code.ElseCode.AcceptVisitor(this); TextComposer .DecreaseIndentation() .AppendLineAtNewLine("}"); }