public override BoundNode VisitDynamicObjectCreationExpression(
            BoundDynamicObjectCreationExpression node
            )
        {
            var loweredArguments      = VisitList(node.Arguments);
            var constructorInvocation = _dynamicFactory
                                        .MakeDynamicConstructorInvocation(
                node.Syntax,
                node.Type,
                loweredArguments,
                node.ArgumentNamesOpt,
                node.ArgumentRefKindsOpt
                )
                                        .ToExpression();

            if (node.InitializerExpressionOpt == null || node.InitializerExpressionOpt.HasErrors)
            {
                return(constructorInvocation);
            }

            return(MakeExpressionWithInitializer(
                       node.Syntax,
                       constructorInvocation,
                       node.InitializerExpressionOpt,
                       node.Type
                       ));
        }
Exemplo n.º 2
0
        public override BoundNode VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
        {
            if (_inExpressionLambda)
            {
                Error(ErrorCode.ERR_ExpressionTreeContainsDynamicOperation, node);
            }

            return(base.VisitDynamicObjectCreationExpression(node));
        }
                public override BoundNode?VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
                {
                    if (!node.ArgumentRefKindsOpt.IsDefault)
                    {
                        _mightAssignSomething = true;
                    }
                    else
                    {
                        base.VisitDynamicObjectCreationExpression(node);
                    }

                    return(null);
                }
Exemplo n.º 4
0
        public override BoundNode VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
        {
            // There are no target types for dynamic object creation scenarios, so there should be no implicit handler conversions
            AssertNoImplicitInterpolatedStringHandlerConversions(node.Arguments);
            var loweredArguments      = VisitList(node.Arguments);
            var constructorInvocation = _dynamicFactory.MakeDynamicConstructorInvocation(node.Syntax, node.Type, loweredArguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt).ToExpression();

            if (node.InitializerExpressionOpt == null || node.InitializerExpressionOpt.HasErrors)
            {
                return(constructorInvocation);
            }

            return(MakeExpressionWithInitializer(node.Syntax, constructorInvocation, node.InitializerExpressionOpt, node.Type));
        }
        public override BoundNode VisitDynamicObjectCreationExpression(BoundDynamicObjectCreationExpression node)
        {
            var loweredArguments = VisitList(node.Arguments);

            return(_dynamicFactory.MakeDynamicConstructorInvocation(node.Syntax, node.Type, loweredArguments, node.ArgumentNamesOpt, node.ArgumentRefKindsOpt).ToExpression());
        }