protected override void WriteBlockContents(Writer writer) { if (Variables.Count > 0) { writer.Write("var "); bool first = true; foreach (string variableName in Variables.Keys) { if (first) { first = false; } else { writer.Write(", "); } writer.Write(variableName); Variable v = Variables[variableName]; if (v.InitialValue != null) { writer.Write(" = "); v.InitialValue.WriteTo(writer); } } writer.Write(";"); if (this.Count > 0) { writer.WriteLineThenIndent(); } } base.WriteBlockContents(writer); }
public override void WriteTo(Writer writer) { WriteBlockContents(writer); writer.WriteLineThenIndent(); }
public override void WriteTo(Writer writer) { for (int i = 0; i < Assignments.Count; i++) { if (i > 0) { writer.Write(";"); writer.WriteLineThenIndent(); } Assignments[i].WriteTo(writer); } }
public override void WriteTo(Writer writer) { writer.Write("if ("); Condition.WriteTo(writer); writer.Write(") "); ThenDoThis.WriteTo(writer); if (ElseDoThis.Count != 0) { writer.WriteLineThenIndent(); writer.Write("else "); if (ElseDoThis.Count == 1 && ElseDoThis[0] is If) { ElseDoThis[0].WriteTo(writer); } else { ElseDoThis.WriteTo(writer); } } }