Exemple #1
0
        public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
        {
            BoundSpillSequenceBuilder builder = null;
            var initializers = this.VisitExpressionList(ref builder, node.Initializers);

            return(UpdateExpression(builder, node.Update(initializers)));
        }
        public override BoundNode VisitArrayCreation(BoundArrayCreation node)
        {
            ReadOnlyArray <BoundExpression> bounds             = this.VisitList(node.Bounds);
            BoundArrayInitialization        visitedInitializer = (BoundArrayInitialization)this.Visit(node.InitializerOpt);
            TypeSymbol type = this.VisitType(node.Type);

            if (!RequiresSpill(bounds) && (visitedInitializer == null || !RequiresSpill(visitedInitializer.Initializers)))
            {
                return(node.Update(bounds, visitedInitializer, type));
            }

            var spillBuilder = new SpillBuilder();
            ReadOnlyArray <BoundExpression> newBounds         = SpillExpressionList(spillBuilder, bounds);
            BoundArrayInitialization        newInitializerOpt = (visitedInitializer == null) ? visitedInitializer :
                                                                visitedInitializer.Update(SpillExpressionList(spillBuilder, visitedInitializer.Initializers));
            BoundArrayCreation newArrayCreation = node.Update(newBounds, newInitializerOpt, type);

            return(spillBuilder.BuildSequenceAndFree(F, newArrayCreation));
        }
 public override BoundNode VisitArrayInitialization(BoundArrayInitialization node)
 {
     BoundSpillSequence2 ss = null;
     var initializers = this.VisitExpressionList(ref ss, node.Initializers);
     return UpdateExpression(ss, node.Update(initializers));
 }
Exemple #4
0
 internal static ImmutableArray <BoundExpression> GetChildInitializers(BoundArrayInitialization arrayInitializer)
 {
     return(arrayInitializer?.Initializers ?? ImmutableArray <BoundExpression> .Empty);
 }
Exemple #5
0
        IArrayInitializer MakeInitializer(BoundArrayInitialization initializer)
        {
            return ArrayInitializerMappings.GetValue(
                initializer,
                (arrayInitializer) =>
                {
                    ArrayBuilder<IArrayInitializer> dimension = ArrayBuilder<IArrayInitializer>.GetInstance(arrayInitializer.Initializers.Length);
                    for (int index = 0; index < arrayInitializer.Initializers.Length; index++)
                    {
                        BoundExpression elementInitializer = arrayInitializer.Initializers[index];
                        BoundArrayInitialization elementArray = elementInitializer as BoundArrayInitialization;
                        dimension[index] = elementArray != null ? MakeInitializer(elementArray) : new ElementInitializer(elementInitializer);
                    }

                    return new DimensionInitializer(dimension.ToImmutableAndFree());
                });
        }