Пример #1
0
        public override BoundNode VisitArrayCreation(BoundArrayCreation node)
        {
            BoundSpillSequence2 ss = null;
            var init = (BoundArrayInitialization)VisitExpression(ref ss, node.InitializerOpt);
            ImmutableArray<BoundExpression> bounds;
            if (ss == null)
            {
                bounds = VisitExpressionList(ref ss, node.Bounds);
            }
            else
            {
                // spill bounds expressions if initializers contain await
                var ss2 = new BoundSpillSequence2();
                bounds = VisitExpressionList(ref ss2, node.Bounds, forceSpill: true);
                ss2.IncludeSequence(ss);
                ss = ss2;
            }

            return UpdateExpression(ss, node.Update(bounds, init, node.Type));
        }
        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);
        }