Skip to content

Commit

Permalink
Remove ApplyVisitor
Browse files Browse the repository at this point in the history
  • Loading branch information
bfarmer67 committed Aug 28, 2024
1 parent 0da20fd commit 912d8cd
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/Hyperbee.AsyncExpressions/AsyncExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Xml.Linq;

namespace Hyperbee.AsyncExpressions;

Expand Down Expand Up @@ -38,20 +37,14 @@ internal static Task<T> ExecuteAsync<T>( Expression body, ParameterExpression[]
public override Expression Reduce()
{
if ( !_isVisited )
ApplyVisitor();
{
_isVisited = true;
_visitedBody = new AsyncVisitor( _body ).Visit();
}

return _visitedBody;
}

private void ApplyVisitor()
{
if ( _isVisited )
return;

_isVisited = true;
_visitedBody = new AsyncVisitor( _body ).Visit();
}

internal class AsyncVisitor : ExpressionVisitor
{
private readonly Expression _body;
Expand Down Expand Up @@ -134,9 +127,10 @@ private static MethodInfo MakeGenericExecuteAsyncMethod( Type typeArg )

private static Expression[] ConvertArguments( IEnumerable<Expression> expressions )
{
return expressions.Select( e => Convert( e, typeof(object) ) ).Cast<Expression>().ToArray();
return expressions.Select( x => Convert( x, typeof(object) ) ).Cast<Expression>().ToArray();
}
}

/*
public static Expression ExecuteAsyncExpression(Type resultType, Expression body, ParameterExpression[] parameterExpressions, params Expression[] parameters)
{
Expand Down

0 comments on commit 912d8cd

Please sign in to comment.