<commit_before>using System;
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
using Remotion.Linq.Parsing;

namespace NHibernate.Linq.Visitors
{
	public class NhExpressionTreeVisitor : ExpressionTreeVisitor
	{
		public override Expression VisitExpression(Expression expression)
		{
			if (expression == null)
			{
				return null;
			}

			switch ((NhExpressionType)expression.NodeType)
			{
				case NhExpressionType.Average:
				case NhExpressionType.Min:
				case NhExpressionType.Max:
				case NhExpressionType.Sum:
				case NhExpressionType.Count:
				case NhExpressionType.Distinct:
					return VisitNhAggregate((NhAggregatedExpression)expression);
				case NhExpressionType.New:
					return VisitNhNew((NhNewExpression)expression);
				case NhExpressionType.Star:
					return VisitNhStar((NhStarExpression)expression);
			}

			return base.VisitExpression(expression);
		}

		protected virtual Expression VisitNhStar(NhStarExpression expression)
		{
			var newExpression = VisitExpression(expression.Expression);

			return newExpression != expression.Expression ? new NhStarExpression(newExpression) : expression;
		}

		protected virtual Expression VisitNhNew(NhNewExpression expression)
		{
			var arguments = VisitAndConvert(expression.Arguments, "VisitNhNew");

			return arguments != expression.Arguments ? new NhNewExpression(expression.Members, arguments) : expression;
		}

		protected virtual Expression VisitNhAggregate(NhAggregatedExpression expression)
		{
			switch ((NhExpressionType)expression.NodeType)
			{
				case NhExpressionType.Average:
					return VisitNhAverage((NhAverageExpression)expression);
				case NhExpressionType.Min:
					return VisitNhMin((NhMinExpression)expression);
				case NhExpressionType.Max:
					return VisitNhMax((NhMaxExpression)expression);
				case NhExpressionType.Sum:
					return VisitNhSum((NhSumExpression)expression);
				case NhExpressionType.Count:<commit_msg>NhExpressionTreeVisitor: Ease debugging in VisitExpression().<commit_after>using System;
using System.Linq.Expressions;
using NHibernate.Linq.Expressions;
using Remotion.Linq.Parsing;

namespace NHibernate.Linq.Visitors
{
	public class NhExpressionTreeVisitor : ExpressionTreeVisitor
	{
		public override Expression VisitExpression(Expression expression)
		{
			if (expression == null)
			{
				return null;
			}

			switch ((NhExpressionType)expression.NodeType)
			{
				case NhExpressionType.Average:
				case NhExpressionType.Min:
				case NhExpressionType.Max:
				case NhExpressionType.Sum:
				case NhExpressionType.Count:
				case NhExpressionType.Distinct:
					return VisitNhAggregate((NhAggregatedExpression)expression);
				case NhExpressionType.New:
					return VisitNhNew((NhNewExpression)expression);
				case NhExpressionType.Star:
					return VisitNhStar((NhStarExpression)expression);
			}

			// Keep this variable for easy examination during debug.
			var expr = base.VisitExpression(expression);
			return expr;
		}

		protected virtual Expression VisitNhStar(NhStarExpression expression)
		{
			var newExpression = VisitExpression(expression.Expression);

			return newExpression != expression.Expression ? new NhStarExpression(newExpression) : expression;
		}

		protected virtual Expression VisitNhNew(NhNewExpression expression)
		{
			var arguments = VisitAndConvert(expression.Arguments, "VisitNhNew");

			return arguments != expression.Arguments ? new NhNewExpression(expression.Members, arguments) : expression;
		}

		protected virtual Expression VisitNhAggregate(NhAggregatedExpression expression)
		{
			switch ((NhExpressionType)expression.NodeType)
			{
				case NhExpressionType.Average:
					return VisitNhAverage((NhAverageExpression)expression);
				case NhExpressionType.Min:
					return VisitNhMin((NhMinExpression)expression);
				case NhExpressionType.Max:
					return VisitNhMax((NhMaxExpression)expression);
				case NhExpressionType.Sum:
					return VisitNhSum((NhSumExpression)expression);
				case NhExpressionType.Count:
{'fraction_non_alphanumeric': 0.07655860349127182, 'fraction_numerical': 0.0, 'mean_word_length': 5.0225225225225225, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6436242', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1111, 'n_words': 224}