Exemplo n.º 1
0
        public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
        {
            Debug.Assert(node.InitializerExpressionOpt == null);
            BoundSpillSequenceBuilder builder = null;
            var arguments = this.VisitExpressionList(ref builder, node.Arguments, node.ArgumentRefKindsOpt);

            return(UpdateExpression(builder, node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ConstantValueOpt, node.InitializerExpressionOpt, node.BinderOpt, node.Type)));
        }
        public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
        {
            ReadOnlyArray <BoundExpression> arguments = (ReadOnlyArray <BoundExpression>) this.VisitList(node.Arguments);
            BoundExpression initializerExpressionOpt  = (BoundExpression)this.Visit(node.InitializerExpressionOpt);
            TypeSymbol      type = this.VisitType(node.Type);

            if (!RequiresSpill(arguments) && (initializerExpressionOpt == null || initializerExpressionOpt.Kind != BoundKind.SpillSequence))
            {
                return(node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ConstantValueOpt, initializerExpressionOpt, type));
            }

            var spillBuilder = new SpillBuilder();
            ReadOnlyArray <BoundExpression> newArguments = SpillExpressionList(spillBuilder, arguments);

            BoundExpression newInitializerExpressionOpt;

            if (initializerExpressionOpt != null && initializerExpressionOpt.Kind == BoundKind.SpillSequence)
            {
                var spill = (BoundSpillSequence)initializerExpressionOpt;
                spillBuilder.AddSpill(spill);
                newInitializerExpressionOpt = spill.Value;
            }
            else
            {
                newInitializerExpressionOpt = initializerExpressionOpt;
            }

            BoundObjectCreationExpression newObjectCreation = node.Update(
                node.Constructor,
                newArguments,
                node.ArgumentNamesOpt,
                node.ArgumentRefKindsOpt,
                node.Expanded,
                node.ArgsToParamsOpt,
                node.ConstantValueOpt,
                newInitializerExpressionOpt,
                type);

            return(spillBuilder.BuildSequenceAndFree(F, newObjectCreation));
        }
Exemplo n.º 3
0
 public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
 {
     Debug.Assert(node.InitializerExpressionOpt == null);
     BoundSpillSequence2 ss = null;
     var arguments = this.VisitExpressionList(ref ss, node.Arguments, node.ArgumentRefKindsOpt);
     return UpdateExpression(ss, node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ConstantValueOpt, node.InitializerExpressionOpt, node.Type));
 }
        public override BoundNode VisitObjectCreationExpression(BoundObjectCreationExpression node)
        {
            ReadOnlyArray<BoundExpression> arguments = (ReadOnlyArray<BoundExpression>)this.VisitList(node.Arguments);
            BoundExpression initializerExpressionOpt = (BoundExpression)this.Visit(node.InitializerExpressionOpt);
            TypeSymbol type = this.VisitType(node.Type);

            if (!RequiresSpill(arguments) && (initializerExpressionOpt == null || initializerExpressionOpt.Kind != BoundKind.SpillSequence))
            {
                return node.Update(node.Constructor, arguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt, node.Expanded, node.ArgsToParamsOpt, node.ConstantValueOpt, initializerExpressionOpt, type);
            }

            var spillBuilder = new SpillBuilder();
            ReadOnlyArray<BoundExpression> newArguments = SpillExpressionList(spillBuilder, arguments);

            BoundExpression newInitializerExpressionOpt;
            if (initializerExpressionOpt != null && initializerExpressionOpt.Kind == BoundKind.SpillSequence)
            {
                var spill = (BoundSpillSequence)initializerExpressionOpt;
                spillBuilder.AddSpill(spill);
                newInitializerExpressionOpt = spill.Value;
            }
            else
            {
                newInitializerExpressionOpt = initializerExpressionOpt;
            }

            BoundObjectCreationExpression newObjectCreation = node.Update(
                node.Constructor,
                newArguments,
                node.ArgumentNamesOpt,
                node.ArgumentRefKindsOpt,
                node.Expanded,
                node.ArgsToParamsOpt,
                node.ConstantValueOpt,
                newInitializerExpressionOpt,
                type);

            return spillBuilder.BuildSequenceAndFree(F, newObjectCreation);
        }