Exemplo n.º 1
0
        public override BoundNode VisitNewT(BoundNewT node)
        {
            if (_inExpressionLambda)
            {
                return(node.Update(MakeObjectCreationInitializerForExpressionTree(node.InitializerExpressionOpt), node.Type));
            }

            var rewrittenNewT = MakeNewT(node.Syntax, (TypeParameterSymbol)node.Type);

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

            return(MakeExpressionWithInitializer(node.Syntax, rewrittenNewT, node.InitializerExpressionOpt, rewrittenNewT.Type !));
        }
Exemplo n.º 2
0
        public override BoundNode VisitNewT(BoundNewT node)
        {
            base.VisitNewT(node);
            HashSet <DiagnosticInfo> useSiteDiagnostics = null;

            if (Conversions.IsBaseInterface(IDisposableType, node.Type, ref useSiteDiagnostics))
            {
                if (!this.State.possiblyUndisposedCreations.Add(node) && reported.Add(node.Syntax))
                {
                    Diagnostics.Add(ErrorCode.WRN_CA2000_DisposeObjectsBeforeLosingScope1, node.Syntax.Location, node.Type);
                }

                return(node);
            }

            return(null);
        }
 private BoundExpression VisitNewT(BoundNewT node)
 {
     return VisitObjectCreationContinued(ExprFactory("New", _bound.Typeof(node.Type)), node.InitializerExpressionOpt);
 }
Exemplo n.º 4
0
 private BoundExpression VisitNewT(BoundNewT node)
 {
     return(VisitObjectCreationContinued(ExprFactory("New", _bound.Typeof(node.Type)), node.InitializerExpressionOpt));
 }
        public override BoundNode VisitNewT(BoundNewT node)
        {
            if (_inExpressionLambda)
            {
                return node.Update(MakeObjectCreationInitializerForExpressionTree(node.InitializerExpressionOpt), node.Type);
            }

            var rewrittenNewT = MakeNewT(node.Syntax, (TypeParameterSymbol)node.Type);
            if (node.InitializerExpressionOpt == null || node.InitializerExpressionOpt.HasErrors)
            {
                return rewrittenNewT;
            }

            return MakeObjectCreationWithInitializer(node.Syntax, rewrittenNewT, node.InitializerExpressionOpt, rewrittenNewT.Type);
        }