protected ListInitExpression UpdateListInit(ListInitExpression init, NewExpression nex, IEnumerable<ElementInit> initializers)
 {
     if (nex != init.NewExpression || initializers != init.Initializers) {
         return Expression.ListInit(nex, initializers);
     }
     return init;
 }
            protected override SystemLinq.Expression VisitListInit(SystemLinq.ListInitExpression node)
            {
                var n            = VisitNew(node.NewExpression);
                var initializers = VisitElementInitializerList(node.Initializers);

                return(new RemoteLinq.ListInitExpression(n, initializers).Wrap());
            }
Esempio n. 3
0
 protected override Expression VisitListInit(ListInitExpression node)
 {
     // If we here, than eval the whole block failed, don't touch constructor!
     _allowEval = false;
     var newExpr = VisitAndConvert(node.NewExpression, "VisitListInit");
     _allowEval = true;
     // ReSharper disable once AssignNullToNotNullAttribute
     return node.Update(newExpr, Visit(node.Initializers, VisitElementInit));
 }
Esempio n. 4
0
 protected static ListInitExpression UpdateListInit(ListInitExpression node, NewExpression nex,
                                                    IEnumerable<ElementInit> initializers)
 {
     if (node.NewExpression != nex || node.Initializers != initializers)
     {
         return Expression.ListInit(nex, initializers);
     }
     return node;
 }
Esempio n. 5
0
 private SqlExpression VisitListInit(ListInitExpression list) {
     if (null != list.NewExpression.Constructor && 0 != list.NewExpression.Arguments.Count) {
         // Throw existing exception for unrecognized expressions if list
         // init does not use a default constructor.
         throw Error.UnrecognizedExpressionNode(list.NodeType);
     }
     SqlExpression[] exprs = new SqlExpression[list.Initializers.Count];
     for (int i = 0, n = exprs.Length; i < n; i++) {
         if (1 != list.Initializers[i].Arguments.Count) {
             // Throw existing exception for unrecognized expressions if element
             // init is not adding a single element.
             throw Error.UnrecognizedExpressionNode(list.NodeType);
         }
         exprs[i] = this.VisitExpression(list.Initializers[i].Arguments.Single());
     }
     return new SqlClientArray(list.Type, this.typeProvider.From(list.Type), exprs, this.dominatingExpression);
 }
        protected override Expression VisitListInit(ListInitExpression expression)
        {
            ListInitExpression current;
            if (!TryGetCurrent(expression, out current))
            {
                return expression;
            }

            if (!(this.result &= current.NodeType == expression.NodeType))
            {
                return expression;
            }

            if (!(this.result &= current.Type == expression.Type))
            {
                return expression;
            }

            this.currentObject = current.NewExpression;
            this.VisitNew(expression.NewExpression);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current.Initializers;
            this.VisitElementInitializerList(expression.Initializers);
            if (!this.result)
            {
                return expression;
            }

            this.currentObject = current;
            return expression;
        }
 protected virtual Expression VisitListInit(ListInitExpression init, Stack<string> stack, Stack<IElasticPropertyAttribute> properties)
 {
     NewExpression n = this.VisitNew(init.NewExpression, stack, properties);
     IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers, stack, properties);
     if (n != init.NewExpression || initializers != init.Initializers)
     {
         return Expression.ListInit(n, initializers);
     }
     return init;
 }
Esempio n. 8
0
 protected internal override Expression VisitListInit(ListInitExpression node)
 {
     Visit(node.NewExpression);
     VisitExpressions('{', ',', Theraot.Collections.Extensions.AsArray(node.Initializers), e => VisitElementInit(e));
     return(node);
 }
 protected internal virtual new Expression VisitListInit(ListInitExpression node)
 {
     return(default(Expression));
 }
 public ListInitExpressionMutator(ListInitExpression expression)
 {
     ListInitExpression = expression;
 }
Esempio n. 11
0
 protected virtual bool VisitListInit(ListInitExpression init, ListInitExpression init2)
 {
     return(VisitNew(init.NewExpression, init2.NewExpression) &&
            VisitElementInitializerList(init.Initializers, init2.Initializers));
 }
Esempio n. 12
0
 protected override string VisitListInit(ListInitExpression node) => null;
Esempio n. 13
0
        protected internal virtual new Expression VisitListInit(ListInitExpression node)
        {
            Contract.Requires(node != null);

            return(default(Expression));
        }
 protected internal virtual Expression VisitListInit(ListInitExpression node)
 {
     return(node.Update(this.VisitAndConvert <NewExpression>(node.NewExpression, "VisitListInit"), Visit <ElementInit>(node.Initializers, new Func <ElementInit, ElementInit>(this.VisitElementInit))));
 }
 /// <summary>
 /// Makes an expression slim representing a ListInitExpression with the given children.
 /// </summary>
 /// <param name="node">Original expression.</param>
 /// <param name="newExpression">New expression slim.</param>
 /// <param name="initializers">Slim element initializers.</param>
 /// <returns>Slim representation of the original expression.</returns>
 protected override ExpressionSlim MakeListInit(ListInitExpression node, NewExpressionSlim newExpression, ReadOnlyCollection <ElementInitSlim> initializers)
 {
     return(_factory.ListInit(newExpression, initializers));
 }
Esempio n. 16
0
 protected virtual Expression VisitListInit(ListInitExpression node)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 internal override Expression VisitListInit(ListInitExpression init)
 {
     throw new NotSupportedException(Strings.ALinq_ExpressionNotSupportedInProjectionToEntity(this.type, init.ToString()));
 }
 /// <summary>
 /// Visits a ListInitExpression.
 /// </summary>
 /// <param name="node">The ListInitExpression.</param>
 /// <returns>The ListInitExpression.</returns>
 protected override Expression VisitListInit(ListInitExpression node)
 {
     _sb.Append("<ListInitExpression>");
     return node;
 }
Esempio n. 19
0
 public ListInitExpressionProxy(ListInitExpression node)
 {
     ArgumentNullException.ThrowIfNull(node);
     _node = node;
 }
Esempio n. 20
0
 /// <summary>
 /// ListInitExpression visit method
 /// </summary>
 /// <param name="init">The ListInitExpression to visit</param>
 /// <returns>The visited ListInitExpression</returns>
 internal override Expression VisitListInit(ListInitExpression init)
 {
     this.cantTranslateExpression = true;
     return init;
 }
Esempio n. 21
0
 private Expression Convert(LinqExp.ListInitExpression linqListInit)
 {
     return(Expression.ListInit(
                Convert(linqListInit.NewExpression),
                linqListInit.Initializers.Project(Convert)));
 }
 protected virtual System.Linq.Expressions.Expression VisitListInit(ListInitExpression init)
 {
     NewExpression n = VisitNew(init.NewExpression);
     IEnumerable<ElementInit> initializers = VisitElementInitializerList(init.Initializers);
     // ReSharper disable once PossibleUnintendedReferenceComparison
     if(n != init.NewExpression || initializers != init.Initializers)
     {
         return System.Linq.Expressions.Expression.ListInit(n, initializers);
     }
     return init;
 }
 public ListInitExpressionProxy(ListInitExpression node)
 {
     ContractUtils.RequiresNotNull(node, nameof(node));
     _node = node;
 }
 public ListInitExpressionProxy(ListInitExpression node) {
     _node = node;
 }
Esempio n. 25
0
 /// <inheritdoc />
 protected override Expression VisitListInit(ListInitExpression init) => Expression.ListInit(VisitNew(init.NewExpression), VisitElementInitializerList(init.Initializers));
Esempio n. 26
0
 /// <summary>
 /// Visits a ListInitExpression.
 /// </summary>
 /// <param name="node">The ListInitExpression.</param>
 /// <returns>The ListInitExpression (possibly modified).</returns>
 protected virtual Expression VisitListInit(ListInitExpression node)
 {
     NewExpression n = VisitNew(node.NewExpression);
     IEnumerable<ElementInit> initializers = VisitElementInitList(node.Initializers);
     return UpdateListInit(node, n, initializers);
 }
Esempio n. 27
0
 public ListInitExpressionProxy(ListInitExpression node)
 {
     _node = node;
 }
Esempio n. 28
0
 internal virtual Expression VisitListInit(ListInitExpression init)
 {
     NewExpression newExpression = this.VisitNew(init.NewExpression);
     IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers);
     if ((newExpression == init.NewExpression) && (initializers == init.Initializers))
     {
         return init;
     }
     return Expression.ListInit(newExpression, initializers);
 }
 protected virtual void VisitListInit(ListInitExpression init)
 {
     VisitNew(init.NewExpression);
     VisitElementInitializerList(init.Initializers);
 }
Esempio n. 30
0
        /// <summary>
        /// Visits the children of the <c>ListInitExpression</c>.
        /// </summary>
        /// <param name="init">The expression to visit.</param>
        /// <returns>The modified expression, if it or any subexpression was modified; 
        /// otherwise, returns the original expression.</returns>
        protected virtual Expression VisitListInit(ListInitExpression init)
        {
            if (init == null)
                throw new ArgumentNullException("init");

            var n = VisitNew(init.NewExpression);
            var initializers = VisitElementInitializerList(init.Initializers);
            if (n == init.NewExpression && initializers == init.Initializers)
                return init;
            return Expression.ListInit(n, initializers);
        }
Esempio n. 31
0
 protected internal override Expression VisitListInit(ListInitExpression node)
 {
     Visit(node.NewExpression);
     VisitExpressions('{', ',', node.Initializers, e => VisitElementInit(e));
     return(node);
 }
Esempio n. 32
0
 protected virtual Expression VisitListInit(ListInitExpression init)
 {
     var n = VisitNew(init.NewExpression);
     var initializers = VisitElementInitializerList(init.Initializers);
     return n != init.NewExpression || !Equals(initializers, init.Initializers) ? Expression.ListInit(n, initializers) : init;
 }
Esempio n. 33
0
 public virtual void Visit(ListInitExpression expression) {
     if (VisitListInit != null)
         VisitListInit(expression);
 }
Esempio n. 34
0
 internal override Expression VisitListInit(ListInitExpression init)
 {
     throw new NotSupportedException(Strings.ALinq_ListInitNotSupported);
 }
 internal virtual Expression VisitListInit(ListInitExpression init)
 {
     var n = VisitNew(init.NewExpression);
     var initializers = VisitElementInitializerList(init.Initializers);
     if (n != init.NewExpression
         || initializers != init.Initializers)
     {
         return Expression.ListInit(n, initializers);
     }
     return init;
 }
 /// <summary>
 /// ListInitExpression visit method
 /// </summary>
 /// <param name="init">The ListInitExpression to visit</param>
 /// <returns>The visited ListInitExpression</returns>
 internal override Expression VisitListInit(ListInitExpression init)
 {
     throw new NotImplementedException();
 }
    public virtual bool IsEvaluatableListInit (ListInitExpression node)
    {
      ArgumentUtility.CheckNotNull ("node", node);

      return true;
    }
Esempio n. 38
0
 protected virtual bool CompareListInit(ListInitExpression a, ListInitExpression b)
 {
     return this.Compare(a.NewExpression, b.NewExpression)
         && this.CompareElementInitList(a.Initializers, b.Initializers);
 }
Esempio n. 39
0
 protected override Expression VisitListInit(ListInitExpression init)
 {
     this.Visit(init.NewExpression);
     this.Write(" {");
     this.WriteLine(Indentation.Inner);
     this.VisitElementInitializerList(init.Initializers);
     this.WriteLine(Indentation.Outer);
     this.Write("}");
     return init;
 }
Esempio n. 40
0
 protected virtual Expression VisitListInit(ListInitExpression init)
 {
     NewExpression n = this.VisitNew(init.NewExpression);
     IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers);
     return this.UpdateListInit(init, n, initializers);
 }
        /// <summary>
        /// Visit a list initializatio expression.
        /// </summary>
        /// <param name="listInitExp"></param>
        /// <returns></returns>
        protected virtual Expression VisitListInit(ListInitExpression listInitExp)
        {
            NewExpression n = VisitNew(listInitExp.NewExpression);
            IEnumerable<ElementInit> initializers = VisitElementInitializerList(listInitExp.Initializers);

            return n != listInitExp.NewExpression || initializers != listInitExp.Initializers
                       ? Expression.ListInit(n, initializers)
                       : listInitExp;
        }
Esempio n. 42
0
 private static string VisitListInit(ListInitExpression node)
 {
     throw new NotImplementedException();
 }
 internal override Expression VisitListInit(ListInitExpression init)
 {
     throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, SR.ALinqExpressionNotSupportedInProjectionToEntity, this.type, init.ToString()));
 }
 /// <summary>
 /// Visits a ListInitExpression.
 /// </summary>
 /// <param name="node">The ListInitExpression.</param>
 /// <returns>The ListInitExpression.</returns>
 protected override Expression VisitListInit(ListInitExpression node)
 {
     throw new NotImplementedException();
 }
Esempio n. 45
0
 private static IList<string> WriteEx(ListInitExpression expression, string header, int depth)
 {
     var lines = new List<string> { WriteHeader(expression, header, depth++) };
     lines.AddRange(Write(expression.NewExpression, "New", depth));
     for (int i = 0; i < expression.Initializers.Count; i++)
     {
         lines.Add(WriteLiteral(expression.Initializers[i].AddMethod.Name, string.Format("Method{0:0##}", i), depth));
         for (int j = 0; j < expression.Initializers[i].Arguments.Count; j++)
         {
             lines.AddRange(Write(expression.Initializers[i].Arguments[j], string.Format("#{0:0##}", j), depth + 1));
         }
     }
     return lines;
 }
 /// <summary>
 /// Visits a ListInitExpression.
 /// </summary>
 /// <param name="init">The ListInitExpression.</param>
 /// <returns>The ListInitExpression (possibly modified).</returns>
 protected virtual Expression VisitListInit(ListInitExpression init)
 {
     NewExpression n = this.VisitNew(init.NewExpression);
     IEnumerable<ElementInit> initializers = this.VisitElementInitializerList(init.Initializers);
     if (n != init.NewExpression || initializers != init.Initializers)
     {
         return Expression.ListInit(n, initializers);
     }
     return init;
 }
Esempio n. 47
0
 protected override Expression VisitListInit(ListInitExpression init) => InvokeEvent(ListInitVisited, init, base.VisitListInit);