示例#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?
            }
        }