protected override Expression VisitMemberInit(MemberInitExpression expression) { if (expression == null) { throw new ArgumentNullException(nameof(expression)); } Visit(expression.Bindings, VisitMemberBinding); // Visit the NewExpression only if the List initializers is evaluatable. It makes no sense to evaluate the ListExpression if the initializers // cannot be evaluated. if (!IsCurrentSubtreeEvaluatable) { return(expression); } Visit(expression.NewExpression); // Testing the parent expression is only required if all children are evaluatable if (IsCurrentSubtreeEvaluatable) { IsCurrentSubtreeEvaluatable = EvaluatableExpressionFilter.IsEvaluatableMemberInit(expression); } return(expression); }
protected override Expression VisitMemberInit(MemberInitExpression expression) { ArgumentUtility.CheckNotNull("expression", expression); Visit(expression.Bindings, VisitMemberBinding); // Visit the NewExpression only if the List initializers is evaluatable. It makes no sense to evaluate the ListExpression if the initializers // cannot be evaluated. if (!_isCurrentSubtreeEvaluatable) { return(expression); } Visit(expression.NewExpression); // Testing the parent expression is only required if all children are evaluatable if (_isCurrentSubtreeEvaluatable) { _isCurrentSubtreeEvaluatable = _evaluatableExpressionFilter.IsEvaluatableMemberInit(expression); } return(expression); }