예제 #1
0
        // collect locals into provided scope
        // leave initializers in the tree if there are any
        public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node)
        {
            ArrayBuilder <BoundStatement> inits = null;

            foreach (var decl in node.LocalDeclarations)
            {
                var init = VisitLocalDeclaration(decl);

                if (init != null)
                {
                    if (inits == null)
                    {
                        inits = ArrayBuilder <BoundStatement> .GetInstance();
                    }

                    inits.Add((BoundStatement)init);
                }
            }

            if (inits != null)
            {
                return(BoundStatementList.Synthesized(node.Syntax, node.HasErrors, inits.ToReadOnlyAndFree()));
            }
            else
            {
                // no initializers
                return(null); // TODO: but what if hasErrors?  Have we lost that?
            }
        }
예제 #2
0
 public override object VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node, object arg)
 {
     foreach (var v in node.LocalDeclarations)
     {
         Visit(v);
     }
     return(null);
 }
예제 #3
0
 public override BoundNode VisitUsingStatement(BoundUsingStatement node)
 {
     var newLocals = RewriteLocals(node.Locals);
     BoundMultipleLocalDeclarations declarationsOpt = (BoundMultipleLocalDeclarations)this.Visit(node.DeclarationsOpt);
     BoundExpression expressionOpt = (BoundExpression)this.Visit(node.ExpressionOpt);
     BoundStatement body = (BoundStatement)this.Visit(node.Body);
     Conversion disposableConversion = RewriteConversion(node.IDisposableConversion);
     return node.Update(newLocals, declarationsOpt, expressionOpt, disposableConversion, body);
 }
예제 #4
0
        // collect locals into provided scope
        // leave initializers in the tree if there are any
        public override BoundNode VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node)
        {
            ArrayBuilder<BoundStatement> inits = null;

            foreach (var decl in node.LocalDeclarations)
            {
                var init = VisitLocalDeclaration(decl);

                if (init != null)
                {
                    if (inits == null)
                    {
                        inits = ArrayBuilder<BoundStatement>.GetInstance();
                    }

                    inits.Add((BoundStatement)init);
                }
            }

            if (inits != null)
            {
                return BoundStatementList.Synthesized(node.Syntax, node.HasErrors, inits.ToReadOnlyAndFree());
            }
            else
            {
                // no initializers
                return null; // TODO: but what if hasErrors?  Have we lost that?
            }
        }