コード例 #1
0
 public override int GetLineCount()
 {
     return(TestTranslation.GetLineCount() +
            IfTrueTranslation.GetLineCount() +
            1 + // for space after the if statement
            IfFalseTranslation.GetLineCount());
 }
コード例 #2
0
 private void WriteSingleLineTernary(TranslationBuffer buffer)
 {
     TestTranslation.WriteInParenthesesIfRequired(buffer);
     buffer.WriteToTranslation(" ? ");
     IfTrueTranslation.WriteTo(buffer);
     buffer.WriteToTranslation(" : ");
     IfFalseTranslation.WriteTo(buffer);
 }
コード例 #3
0
 private void WriteSingleLineTernary(TranslationWriter writer)
 {
     TestTranslation.WriteInParenthesesIfRequired(writer, _context);
     writer.WriteToTranslation(" ? ");
     IfTrueTranslation.WriteTo(writer);
     writer.WriteToTranslation(" : ");
     IfFalseTranslation.WriteTo(writer);
 }
コード例 #4
0
            private void WriteMultiLineTernary(TranslationBuffer buffer)
            {
                TestTranslation.WriteInParenthesesIfRequired(buffer);

                buffer.WriteNewLineToTranslation();
                buffer.Indent();
                buffer.WriteToTranslation("? ");

                IfTrueTranslation.WriteTo(buffer);

                buffer.WriteNewLineToTranslation();
                buffer.WriteToTranslation(": ");

                IfFalseTranslation.WriteTo(buffer);

                buffer.Unindent();
            }
コード例 #5
0
            private void WriteMultiLineTernary(TranslationWriter writer)
            {
                TestTranslation.WriteInParenthesesIfRequired(writer, _context);

                writer.WriteNewLineToTranslation();
                writer.Indent();
                writer.WriteToTranslation("? ");

                IfTrueTranslation.WriteTo(writer);

                writer.WriteNewLineToTranslation();
                writer.WriteToTranslation(": ");

                IfFalseTranslation.WriteTo(writer);

                writer.Unindent();
            }
コード例 #6
0
            private int GetSingleLineTernaryLineCount()
            {
                var lineCount = TestTranslation.GetLineCount();

                var ifTrueLineCount = IfTrueTranslation.GetLineCount();

                if (ifTrueLineCount > 1)
                {
                    lineCount += ifTrueLineCount - 1;
                }

                var ifFalseLineCount = IfFalseTranslation.GetLineCount();

                if (ifFalseLineCount > 1)
                {
                    lineCount += ifFalseLineCount - 1;
                }

                return(lineCount);
            }
コード例 #7
0
 protected void WriteIfStatement(TranslationBuffer buffer)
 {
     buffer.WriteToTranslation("if ");
     TestTranslation.WriteInParentheses(buffer);
     IfTrueTranslation.WriteTo(buffer);
 }
コード例 #8
0
 public override int GetLineCount()
 {
     return(TestTranslation.GetLineCount() +
            IfTrueTranslation.GetLineCount() +
            IfFalseTranslation.GetLineCount());
 }
コード例 #9
0
 public override int GetIndentSize()
 {
     return(TestTranslation.GetIndentSize() +
            IfTrueTranslation.GetIndentSize() +
            IfFalseTranslation.GetIndentSize());
 }
コード例 #10
0
 private int GetMultiLineTernaryLineCount()
 {
     return(TestTranslation.GetLineCount() +
            IfTrueTranslation.GetLineCount() +
            IfFalseTranslation.GetLineCount());
 }
コード例 #11
0
 private int GetSingleLineTernaryIndentSize()
 {
     return(TestTranslation.GetLineCount() +
            IfTrueTranslation.GetIndentSize() +
            IfFalseTranslation.GetIndentSize());
 }
コード例 #12
0
 public override int GetLineCount()
 => TestTranslation.GetLineCount() + IfTrueTranslation.GetLineCount();
コード例 #13
0
 public override int GetIndentSize()
 => TestTranslation.GetIndentSize() + IfTrueTranslation.GetIndentSize();
コード例 #14
0
 protected void WriteIfStatement(TranslationWriter writer)
 {
     writer.WriteControlStatementToTranslation("if ");
     TestTranslation.WriteInParentheses(writer);
     IfTrueTranslation.WriteTo(writer);
 }