protected override Expression VisitStatementExpression(StatementExpression sex)
        {
            if (sex.Body is CommentExpression)
            {
                return Expression.Empty();
            }

            return sex;
        }
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     if (sex.Body is BlockHelperExpression)
     {
         return Visit(sex.Body);
     }
     else
     {
         return sex;
     }
 }
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     if (sex.Body is PartialExpression)
     {
         return Visit(sex.Body);
     }
     else
     {
         return sex;
     }
 }
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     if (sex.Body is PathExpression)
     {
         var writeMethod = typeof(TextWriter).GetMethod("Write", new [] { typeof(object) });
         return Expression.Call(
             Expression.Property(
                 CompilationContext.BindingContext,
                 "TextWriter"),
             writeMethod,
             new[] { Visit(sex.Body) });
     }
     else
     {
         return Visit(sex.Body);
     }
 }
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     if (sex.IsEscaped == false)
     {
         return Expression.Block(
             Expression.Assign(
                 Expression.Property(CompilationContext.BindingContext, "OutputMode"),
                 Expression.Constant(OutputMode.Unencoded)),
             sex,
             Expression.Assign(
                 Expression.Property(CompilationContext.BindingContext, "OutputMode"),
                 Expression.Constant(OutputMode.Encoded)));
     }
     else
     {
         return sex;
     }
 }
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     if (sex.IsEscaped == false)
     {
         return Expression.Block(
             typeof(void),
             Expression.Assign(
                 Expression.Property(CompilationContext.BindingContext, "SuppressEncoding"),
                 Expression.Constant(true)),
             sex,
             Expression.Assign(
                 Expression.Property(CompilationContext.BindingContext, "SuppressEncoding"),
                 Expression.Constant(false)),
             Expression.Empty());
     }
     else
     {
         return sex;
     }
 }
 protected virtual Expression VisitStatementExpression(StatementExpression sex)
 {
     return sex;
 }
 protected override Expression VisitStatementExpression(StatementExpression sex) => sex.Body is PartialExpression?Visit(sex.Body) : sex;
 protected override Expression VisitStatementExpression(StatementExpression sex)
 {
     return(sex.Body is BlockHelperExpression?Visit(sex.Body) : sex);
 }
 private static bool IsBlockStatement(StatementExpression statement)
 {
     return IsBlockHelperOrInversion(statement.Body as HelperExpression) ||
            IsSectionOrClosingNode(statement.Body as PathExpression);
 }
 private static bool IsStandalone(StatementExpression statement)
 {
     return statement.Body is CommentExpression ||
            statement.Body is PartialExpression ||
            IsBlockStatement(statement);
 }
 private static bool IsBlockStatement(StatementExpression statement)
 {
     return(IsBlockHelperOrInversion(statement.Body as HelperExpression) ||
            IsSectionOrClosingNode(statement.Body as PathExpression));
 }
 private static bool IsStandalone(StatementExpression statement)
 {
     return(statement.Body is CommentExpression ||
            statement.Body is PartialExpression ||
            IsBlockStatement(statement));
 }