public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {
            // should this be an extension method to all languages?

            Action WriteCodeStatements =
                delegate
            {
                var History = Code.History.ToArray();

                for (int i = 0; i < History.Length; i++)
                {
                    var IsReturnStatement = false;

                    Code.OwnerMethod.With(
                        m =>
                    {
                        if (m.ReturnType == null)
                        {
                            return;
                        }

                        if (m.IsConstructor)
                        {
                            return;
                        }

                        IsReturnStatement = i == History.Length - 1;
                    }
                        );


                    var item = History[i];

                    {
                        var Comment = item as string;
                        if (Comment != null)
                        {
                            File.WriteIndent();
                            this.WriteCommentLine(File, Comment);
                        }
                    }

                    {
                        var Comment = item as SolutionFileComment;
                        if (Comment != null)
                        {
                            Comment.WriteTo(File, this, Context);
                            return;
                        }
                    }

                    var If = item as PseudoIfExpression;

                    if (If != null)
                    {
                        if (If.IsConditionalCompilationDirective)
                        {
                            this.WriteConditionalCompilation(File, If, Context);
                        }
                        else
                        {
                            File.WriteIndent().WriteSpace(Keywords.@if);
                            File.Write("(");
                            WritePseudoExpression(File, If.Expression, Context);
                            File.Write(")");
                            File.WriteLine();

                            WriteMethodBody(File, If.TrueCase, Context);
                            File.WriteLine();

                            if (If.FalseCase != null)
                            {
                                File.WriteIndent().WriteLine(Keywords.@else);

                                WriteMethodBody(File, If.FalseCase, Context);
                            }
                        }

                        return;
                    }

                    var Lambda = item as PseudoCallExpression;

                    if (Lambda != null)
                    {
                        if (Code.IsLambdaExpression)
                        {
                            WritePseudoCallExpression(File, Lambda, Context);
                        }
                        else
                        {
                            if (Lambda.Comment != null)
                            {
                                Lambda.Comment.WriteTo(File, this, Context);
                            }

                            if (Lambda.Method != null)
                            {
                                File.WriteIndent();

                                if (IsReturnStatement)
                                {
                                    File.WriteSpace(Keywords.@return);
                                }

                                WritePseudoCallExpression(File, Lambda, Context);
                                File.WriteLine(";");
                            }
                        }
                    }
                }
            };

            Action WriteCodeStatementsAsBlock =
                delegate
            {
                File.WriteIndent().WriteLine("{");
                File.Indent(this, WriteCodeStatements);
                File.WriteIndent().Write("}");
            };

            Code.OwnerIfExpression.With(n => n.IsConditionalCompilationDirective, n => WriteCodeStatementsAsBlock = WriteCodeStatements);

            if (Code.IsLambdaExpression)
            {
                WriteCodeStatementsAsBlock = WriteCodeStatements;
            }

            WriteCodeStatementsAsBlock();
        }
        public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {
            var History = Code.History.ToArray();

            for (int i = 0; i < History.Length; i++)
            {
                var IsReturnStatement = false;

                Code.OwnerMethod.With(
                    m =>
                {
                    if (m.ReturnType == null)
                    {
                        return;
                    }

                    if (m.IsConstructor)
                    {
                        return;
                    }

                    IsReturnStatement = i == History.Length - 1;
                }
                    );


                var item = History[i];

                #region Comment
                {
                    var Comment = item as string;
                    if (Comment != null)
                    {
                        File.WriteIndent();
                        this.WriteCommentLine(File, Comment);
                    }
                }

                {
                    var Comment = item as SolutionFileComment;
                    if (Comment != null)
                    {
                        Comment.WriteTo(File, this, Context);
                        return;
                    }
                }
                #endregion

                #region If
                var If = item as PseudoIfExpression;

                if (If != null)
                {
                    if (If.IsConditionalCompilationDirective)
                    {
                        this.WriteConditionalCompilation(File, If, Context);
                    }
                    else
                    {
                        File.WriteIndent();
                        File.WriteSpace(Keywords.@if);
                        WritePseudoExpression(File, If.Expression, Context);
                        File.WriteSpace();
                        File.Write(Keywords.@then);
                        File.WriteLine();

                        WriteMethodBody(File, If.TrueCase, Context);

                        if (If.FalseCase != null)
                        {
                            File.WriteIndent();
                            File.WriteSpace(Keywords.@else);
                            File.WriteLine();

                            WriteMethodBody(File, If.FalseCase, Context);
                        }
                    }

                    return;
                }
                #endregion

                #region Lambda
                var Lambda = item as PseudoCallExpression;

                if (Lambda != null)
                {
                    if (Lambda.Comment != null)
                    {
                        Lambda.Comment.WriteTo(File, this, Context);
                    }

                    if (Lambda.Method != null)
                    {
                        File.WriteIndent();

                        if (IsReturnStatement)
                        {
                            WritePseudoCallExpression(File, Lambda, Context);
                        }
                        else
                        {
                            var ImplicitField = default(SolutionProjectLanguageField);

                            if (Lambda.Method.IsProperty && Lambda.Object is PseudoThisExpression)
                            {
                                ImplicitField = Code.OwnerMethod.DeclaringType.Fields.FirstOrDefault(
                                    k => k.Name == Lambda.Method.Name.SkipUntilIfAny("set_") && k.IsReadOnly
                                    );
                            }

                            if (ImplicitField != null)
                            {
                                File.WriteSpace(Keywords.let).Write(ImplicitField.Name).WriteSpaces("=");


                                WritePseudoExpression(File, Lambda.ParameterExpressions[0], Context);
                            }
                            else
                            {
                                File.WriteSpace(Keywords.@do);

                                // we could group next similar statements in a single do
                                WritePseudoCallExpression(File, Lambda, Context);

                                if (Lambda.Method.ReturnType != null)
                                {
                                    File.WriteSpaces("|>");
                                    File.Write(Keywords.ignore);
                                }
                            }
                        }

                        File.WriteLine();
                    }
                }
                #endregion
            }
        }
        public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {
            // should this be an extension method to all languages?

            Action WriteCodeStatements =
                delegate
            {
                var History = Code.History.ToArray();

                for (int i = 0; i < History.Length; i++)
                {
                    var IsReturnStatement = false;

                    Code.OwnerMethod.With(
                        m =>
                    {
                        if (m.ReturnType == null)
                        {
                            return;
                        }

                        if (m.IsConstructor)
                        {
                            return;
                        }

                        IsReturnStatement = i == History.Length - 1;
                    }
                        );


                    var item = History[i];


                    #region Comment
                    {
                        var Comment = item as string;
                        if (Comment != null)
                        {
                            File.WriteIndent();
                            this.WriteCommentLine(File, Comment);
                        }
                    }

                    {
                        var Comment = item as SolutionFileComment;
                        if (Comment != null)
                        {
                            Comment.WriteTo(File, this, Context);
                            return;
                        }
                    }
                    #endregion


                    #region If
                    var If = item as PseudoIfExpression;

                    if (If != null)
                    {
                        Func <SolutionFile> WriteDirectiveOrIndent = File.WriteIndent;


                        if (If.IsConditionalCompilationDirective)
                        {
                            WriteDirectiveOrIndent = File.WriteDirective;
                        }

                        WriteDirectiveOrIndent().WriteSpace(Keywords.If);
                        WritePseudoExpression(File, If.Expression, Context);
                        File.WriteSpace();
                        File.WriteLine(Keywords.Then);

                        WriteMethodBody(File, If.TrueCase, Context);

                        if (If.FalseCase != null)
                        {
                            WriteDirectiveOrIndent().WriteLine(Keywords.Else);

                            WriteMethodBody(File, If.FalseCase, Context);
                        }

                        WriteDirectiveOrIndent().WriteSpace(Keywords.End).WriteLine(Keywords.@If);

                        return;
                    }
                    #endregion


                    #region Lambda
                    var Lambda = item as PseudoCallExpression;

                    if (Lambda != null)
                    {
                        if (Code.IsLambdaExpression)
                        {
                            WritePseudoCallExpression(File, Lambda, Context);
                        }
                        else
                        {
                            if (Lambda.Comment != null)
                            {
                                Lambda.Comment.WriteTo(File, this, Context);
                            }

                            if (Lambda.Method != null)
                            {
                                File.WriteIndent();

                                if (IsReturnStatement)
                                {
                                    File.WriteSpace(Keywords.@Return);
                                }


                                WritePseudoCallExpression(File, Lambda, Context);
                                File.WriteLine();
                            }
                        }
                    }
                    #endregion
                }
            };

            if (Code.IsConditionalCompilationDirectiveCode)
            {
                WriteCodeStatements();
            }
            else
            {
                File.Indent(this, WriteCodeStatements);
            }
        }
        public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {
            // should this be an extension method to all languages?

            Action WriteCodeStatements =
                delegate
                {
                    var History = Code.History.ToArray();

                    for (int i = 0; i < History.Length; i++)
                    {
                        var IsReturnStatement = false;

                        Code.OwnerMethod.With(
                            m =>
                            {
                                if (m.ReturnType == null)
                                    return;

                                if (m.IsConstructor)
                                    return;

                                IsReturnStatement = i == History.Length - 1;
                            }
                        );


                        var item = History[i];

                        {
                            var Comment = item as string;
                            if (Comment != null)
                            {
                                File.WriteIndent();
                                this.WriteCommentLine(File, Comment);
                            }
                        }

                        {
                            var Comment = item as SolutionFileComment;
                            if (Comment != null)
                            {
                                Comment.WriteTo(File, this, Context);
                                return;
                            }
                        }

                        var If = item as PseudoIfExpression;

                        if (If != null)
                        {
                            if (If.IsConditionalCompilationDirective)
                            {

                                this.WriteConditionalCompilation(File, If, Context);

                            }
                            else
                            {

                                File.WriteIndent().WriteSpace(Keywords.@if);
                                File.Write("(");
                                WritePseudoExpression(File, If.Expression, Context);
                                File.Write(")");
                                File.WriteLine();

                                WriteMethodBody(File, If.TrueCase, Context);
                                File.WriteLine();

                                if (If.FalseCase != null)
                                {
                                    File.WriteIndent().WriteLine(Keywords.@else);

                                    WriteMethodBody(File, If.FalseCase, Context);
                                }
                            }

                            return;
                        }

                        var Lambda = item as PseudoCallExpression;

                        if (Lambda != null)
                        {
                            if (Code.IsLambdaExpression)
                            {
                                WritePseudoCallExpression(File, Lambda, Context);
                            }
                            else
                            {
                                if (Lambda.Comment != null)
                                    Lambda.Comment.WriteTo(File, this, Context);

                                if (Lambda.Method != null)
                                {
                                    File.WriteIndent();

                                    if (IsReturnStatement)
                                    {
                                        File.WriteSpace(Keywords.@return);
                                    }

                                    WritePseudoCallExpression(File, Lambda, Context);
                                    File.WriteLine(";");
                                }
                            }
                        }
                    }
                };

            Action WriteCodeStatementsAsBlock =
                delegate
                {
                    File.WriteIndent().WriteLine("{");
                    File.Indent(this, WriteCodeStatements);
                    File.WriteIndent().Write("}");
                };

            Code.OwnerIfExpression.With(n => n.IsConditionalCompilationDirective, n => WriteCodeStatementsAsBlock = WriteCodeStatements);

            if (Code.IsLambdaExpression)
                WriteCodeStatementsAsBlock = WriteCodeStatements;

            WriteCodeStatementsAsBlock();
        }
        public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {

            var History = Code.History.ToArray();

            for (int i = 0; i < History.Length; i++)
            {
                var IsReturnStatement = false;

                Code.OwnerMethod.With(
                    m =>
                    {
                        if (m.ReturnType == null)
                            return;

                        if (m.IsConstructor)
                            return;

                        IsReturnStatement = i == History.Length - 1;
                    }
                );


                var item = History[i];

                #region Comment
                {
                    var Comment = item as string;
                    if (Comment != null)
                    {
                        File.WriteIndent();
                        this.WriteCommentLine(File, Comment);
                    }
                }

                {
                    var Comment = item as SolutionFileComment;
                    if (Comment != null)
                    {
                        Comment.WriteTo(File, this, Context);
                        return;
                    }
                }
                #endregion

                #region If
                var If = item as PseudoIfExpression;

                if (If != null)
                {
                    if (If.IsConditionalCompilationDirective)
                    {
                        this.WriteConditionalCompilation(File, If, Context);

                    }
                    else
                    {

                        File.WriteIndent();
                        File.WriteSpace(Keywords.@if);
                        WritePseudoExpression(File, If.Expression, Context);
                        File.WriteSpace();
                        File.Write(Keywords.@then);
                        File.WriteLine();

                        WriteMethodBody(File, If.TrueCase, Context);

                        if (If.FalseCase != null)
                        {
                            File.WriteIndent();
                            File.WriteSpace(Keywords.@else);
                            File.WriteLine();

                            WriteMethodBody(File, If.FalseCase, Context);
                        }
                    }

                    return;
                }
                #endregion

                #region Lambda
                var Lambda = item as PseudoCallExpression;

                if (Lambda != null)
                {
                    if (Lambda.Comment != null)
                        Lambda.Comment.WriteTo(File, this, Context);

                    if (Lambda.Method != null)
                    {
                        File.WriteIndent();

                        if (IsReturnStatement)
                        {
                            WritePseudoCallExpression(File, Lambda, Context);
                        }
                        else
                        {
                            var ImplicitField = default(SolutionProjectLanguageField);

                            if (Lambda.Method.IsProperty && Lambda.Object is PseudoThisExpression)
                                ImplicitField = Code.OwnerMethod.DeclaringType.Fields.FirstOrDefault(
                                    k => k.Name == Lambda.Method.Name.SkipUntilIfAny("set_") && k.IsReadOnly
                                );

                            if (ImplicitField != null)
                            {
                                File.WriteSpace(Keywords.let).Write(ImplicitField.Name).WriteSpaces("=");


                                WritePseudoExpression(File, Lambda.ParameterExpressions[0], Context);
                            }
                            else
                            {

                                File.WriteSpace(Keywords.@do);

                                // we could group next similar statements in a single do
                                WritePseudoCallExpression(File, Lambda, Context);

                                if (Lambda.Method.ReturnType != null)
                                {
                                    File.WriteSpaces("|>");
                                    File.Write(Keywords.ignore);
                                }
                            }
                        }

                        File.WriteLine();
                    }
                }
                #endregion

            }



        }
        public override void WriteMethodBody(SolutionFile File, SolutionProjectLanguageCode Code, SolutionBuilder Context)
        {
            // should this be an extension method to all languages?

            Action WriteCodeStatements =
             delegate
             {

                 var History = Code.History.ToArray();

                 for (int i = 0; i < History.Length; i++)
                 {
                     var IsReturnStatement = false;

                     Code.OwnerMethod.With(
                          m =>
                          {
                              if (m.ReturnType == null)
                                  return;

                              if (m.IsConstructor)
                                  return;

                              IsReturnStatement = i == History.Length - 1;
                          }
                     );


                     var item = History[i];


                     #region Comment
                     {
                         var Comment = item as string;
                         if (Comment != null)
                         {
                             File.WriteIndent();
                             this.WriteCommentLine(File, Comment);
                         }
                     }

                     {
                         var Comment = item as SolutionFileComment;
                         if (Comment != null)
                         {
                             Comment.WriteTo(File, this, Context);
                             return;
                         }
                     }
                     #endregion


                     #region If
                     var If = item as PseudoIfExpression;

                     if (If != null)
                     {
                         Func<SolutionFile> WriteDirectiveOrIndent = File.WriteIndent;


                         if (If.IsConditionalCompilationDirective)
                         {
                             WriteDirectiveOrIndent = File.WriteDirective;
                         }

                         WriteDirectiveOrIndent().WriteSpace(Keywords.If);
                         WritePseudoExpression(File, If.Expression, Context);
                         File.WriteSpace();
                         File.WriteLine(Keywords.Then);

                         WriteMethodBody(File, If.TrueCase, Context);

                         if (If.FalseCase != null)
                         {
                             WriteDirectiveOrIndent().WriteLine(Keywords.Else);

                             WriteMethodBody(File, If.FalseCase, Context);
                         }

                         WriteDirectiveOrIndent().WriteSpace(Keywords.End).WriteLine(Keywords.@If);

                         return;
                     }
                     #endregion


                     #region Lambda
                     var Lambda = item as PseudoCallExpression;

                     if (Lambda != null)
                     {
                         if (Code.IsLambdaExpression)
                         {
                             WritePseudoCallExpression(File, Lambda, Context);
                         }
                         else
                         {

                             if (Lambda.Comment != null)
                                 Lambda.Comment.WriteTo(File, this, Context);

                             if (Lambda.Method != null)
                             {
                                 File.WriteIndent();

                                 if (IsReturnStatement)
                                 {
                                     File.WriteSpace(Keywords.@Return);
                                 }


                                 WritePseudoCallExpression(File, Lambda, Context);
                                 File.WriteLine();
                             }
                         }
                     }
                     #endregion

                 }

             };

            if (Code.IsConditionalCompilationDirectiveCode)
                WriteCodeStatements();
            else
                File.Indent(this, WriteCodeStatements);


        }