private Expression TryOptimize(BinaryExpression node) { if (node.NodeType != ExpressionType.Assign) { return(null); } var right = node.Right as LambdaExpression; if (right == null) { return(null); } var left = node.Left as ParameterExpression; if (left == null) { return(null); } var visitor = new TailRecursion(left.Name, left, right); right = visitor.Run(right) as LambdaExpression; if (right == null) { return(null); } return(Expression.Assign(left, right)); }
private Expression TryOptimize(BinaryExpression node) { if (node.NodeType != ExpressionType.Assign) return null; var right = node.Right as LambdaExpression; if (right == null) return null; var left = node.Left as ParameterExpression; if (left == null) return null; var visitor = new TailRecursion(left.Name, left, right); right = visitor.Run(right) as LambdaExpression; if (right == null) return null; return Expression.Assign(left, right); }