public override BoundNode VisitObjectInitializerExpression(BoundObjectInitializerExpression node)
 {
     foreach (var initializer in node.Initializers)
     {
         // Do not treat initializer assignment as a side effect since it is
         // part of an object creation. In short, visit the RHS only.
         var expr = (initializer.Kind == BoundKind.AssignmentOperator) ?
                    ((BoundAssignmentOperator)initializer).Right :
                    initializer;
         this.Visit(expr);
     }
     return(null);
 }
 public override BoundNode VisitObjectInitializerExpression(BoundObjectInitializerExpression node)
 {
     foreach (var initializer in node.Initializers)
     {
         // Do not treat initializer assignment as a side effect since it is
         // part of an object creation. In short, visit the RHS only.
         var expr = (initializer.Kind == BoundKind.AssignmentOperator) ?
             ((BoundAssignmentOperator)initializer).Right :
             initializer;
         this.Visit(expr);
     }
     return null;
 }
Exemplo n.º 3
0
 // Skip visiting `BoundAssignmentOperator` nodes (but not their children) if they are used for initializing members in object creation.
 // The corresponding operations are covered by `IMemberInitializer`.
 public override BoundNode VisitObjectInitializerExpression(BoundObjectInitializerExpression node)
 {
     foreach (var expression in node.Initializers)
     {
         if (expression.HasErrors)
         {
             continue;
         }
         var assignment = (BoundAssignmentOperator) expression;
         this.Visit(assignment.Left);
         this.Visit(assignment.Right);
     }
     return null;
 }