Increment() public method

public Increment ( ) : Indent
return Indent
コード例 #1
0
ファイル: IfThenElement.cs プロジェクト: ashmind/expressive
        public string ToString(Indent indent)
        {
            var builder = new StringBuilder();
            builder.Append(indent.Value)
                   .Append("if ")
                   .Append(this.Condition)
                   .Append(" then:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Then, indent.Increment()));

            if (this.Else.Count == 0)
                return builder.ToString();

            builder.AppendLine()
                   .Append(indent.Value)
                   .Append("else:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Else, indent.Increment()));
            return builder.ToString();
        }
コード例 #2
0
        public string ToString(Indent indent)
        {
            var builder = new StringBuilder();
            var innerIndent = indent.Increment();
            builder.Append(indent.Value)
                   .AppendFormat("branch ({0}):", this.OpCode)
                   .AppendLine()
                   .Append(innerIndent.Value)
                   .Append("target:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Target, innerIndent.Increment()));

            builder.AppendLine()
                   .Append(innerIndent.Value)
                   .Append("fallback:")
                   .AppendLine()
                   .Append(ElementHelper.ToString(this.Fallback, innerIndent.Increment()));
            return builder.ToString();
        }