Example #1
0
        public override BoundNode VisitArrayAccess(BoundArrayAccess node)
        {
            BoundSpillSequenceBuilder builder = null;
            var expression = VisitExpression(ref builder, node.Expression);

            BoundSpillSequenceBuilder indicesBuilder = null;
            var indices = this.VisitExpressionList(ref indicesBuilder, node.Indices);

            if (indicesBuilder != null)
            {
                // spill the array if there were await expressions in the indices
                if (builder == null)
                {
                    builder = new BoundSpillSequenceBuilder();
                }

                expression = Spill(builder, expression);
            }

            if (builder != null)
            {
                builder.Include(indicesBuilder);
                indicesBuilder = builder;
                builder        = null;
            }

            return(UpdateExpression(indicesBuilder, node.Update(expression, indices, node.Type)));
        }
        public override BoundNode VisitArrayAccess(BoundArrayAccess node)
        {
            BoundSpillSequence2 ssArray = null;
            var expression = VisitExpression(ref ssArray, node.Expression);

            BoundSpillSequence2 ssIndices = null;
            var indices = this.VisitExpressionList(ref ssIndices, node.Indices);

            if (ssIndices != null)
            {
                // spill the array if there were await expressions in the indices
                if (ssArray == null)
                {
                    ssArray = new BoundSpillSequence2();
                }
                expression = Spill(ssArray, expression);
            }

            if (ssArray != null)
            {
                ssArray.IncludeSequence(ssIndices);
                ssIndices = ssArray;
                ssArray   = null;
            }
            return(UpdateExpression(ssIndices, node.Update(expression, indices, node.Type)));
        }
        public override BoundNode VisitArrayAccess(BoundArrayAccess node)
        {
            BoundExpression expression = (BoundExpression)this.Visit(node.Expression);
            ReadOnlyArray <BoundExpression> indices = (ReadOnlyArray <BoundExpression>) this.VisitList(node.Indices);
            TypeSymbol type = this.VisitType(node.Type);

            if (!RequiresSpill(indices) && expression.Kind != BoundKind.SpillSequence)
            {
                return(node.Update(expression, indices, type));
            }

            var             spillBuilder        = new SpillBuilder();
            var             spillResult         = SpillExpressionsWithReceiver(expression, indices, spillBuilder, refKindsOpt: ReadOnlyArray <RefKind> .Empty);
            BoundExpression newBoundArrayAccess = node.Update(spillResult.Item1, spillResult.Item2, type);

            return(spillBuilder.BuildSequenceAndFree(F, newBoundArrayAccess));
        }
Example #4
0
        public override BoundNode VisitArrayAccess(BoundArrayAccess node)
        {
            BoundSpillSequence2 ssArray = null;
            var expression = VisitExpression(ref ssArray, node.Expression);

            BoundSpillSequence2 ssIndices = null;
            var indices = this.VisitExpressionList(ref ssIndices, node.Indices);

            if (ssIndices != null)
            {
                // spill the array if there were await expressions in the indices
                if (ssArray == null) ssArray = new BoundSpillSequence2();
                expression = Spill(ssArray, expression);
            }

            if (ssArray != null)
            {
                ssArray.IncludeSequence(ssIndices);
                ssIndices = ssArray;
                ssArray = null;
            }
            return UpdateExpression(ssIndices, node.Update(expression, indices, node.Type));
        }
        public override BoundNode VisitArrayAccess(BoundArrayAccess node)
        {
            BoundExpression expression = (BoundExpression)this.Visit(node.Expression);
            ReadOnlyArray<BoundExpression> indices = (ReadOnlyArray<BoundExpression>)this.VisitList(node.Indices);
            TypeSymbol type = this.VisitType(node.Type);

            if (!RequiresSpill(indices) && expression.Kind != BoundKind.SpillSequence)
            {
                return node.Update(expression, indices, type);
            }

            var spillBuilder = new SpillBuilder();
            var spillResult = SpillExpressionsWithReceiver(expression, indices, spillBuilder, refKindsOpt: ReadOnlyArray<RefKind>.Empty);
            BoundExpression newBoundArrayAccess = node.Update(spillResult.Item1, spillResult.Item2, type);
            return spillBuilder.BuildSequenceAndFree(F, newBoundArrayAccess);
        }