protected override void Visit(ConditionalChunk chunk) { switch (chunk.Type) { case ConditionalType.If: CodeIndent(chunk).Write("If ").WriteCode(chunk.Condition).WriteLine(" Then"); break; case ConditionalType.ElseIf: _source.ClearEscrowLine(); CodeIndent(chunk).Write("ElseIf ").WriteCode(chunk.Condition).WriteLine(" Then"); break; case ConditionalType.Else: _source.ClearEscrowLine(); _source.WriteLine("Else"); break; case ConditionalType.Once: _source.Write("If Once(").WriteCode(chunk.Condition).WriteLine(") Then"); break; default: throw new CompilerException(string.Format("Unknown ConditionalChunk type {0}", chunk.Type)); } _source .AddIndent(); PushScope(); Accept(chunk.Body); PopScope(); _source .RemoveIndent() .EscrowLine("End If"); }
protected override void Visit(ConditionalChunk chunk) { switch (chunk.Type) { case ConditionalType.If: _source.Write("if ").WriteLine(chunk.Condition); break; case ConditionalType.ElseIf: _source.ClearEscrowLine(); _source.Write("elsif ").WriteLine(chunk.Condition); break; case ConditionalType.Else: _source.ClearEscrowLine(); _source.Write("else ").WriteLine(chunk.Condition); break; case ConditionalType.Once: _source.Write("if once(").Write(chunk.Condition).WriteLine(")"); break; default: throw new CompilerException(string.Format("Unknown ConditionalChunk type {0}", chunk.Type)); } _source.Indent++; _variables.PushScope(); Accept(chunk.Body); _variables.PopScope(); _source.Indent--; _source.EscrowLine("end"); }