Expression ConvertExpressionToTemporaryVariable(Expression methodInvocation, Block block) { var temporaryVariable = new ReferenceExpression(Context.GetUniqueName("with")); var assignment = new WithBinaryExpression { Operator = BinaryOperatorType.Assign, Left = Expression.Lift(temporaryVariable), Right = methodInvocation }; block.Insert(0, assignment); return(temporaryVariable); }
Expression ConvertExpressionToTemporaryVariable(Expression methodInvocation, Block block) { var temporaryVariable = new ReferenceExpression(Context.GetUniqueName("with")); var assignment = new WithBinaryExpression { Operator = BinaryOperatorType.Assign, Left = Expression.Lift(temporaryVariable), Right = methodInvocation }; block.Insert(0, assignment); return temporaryVariable; }