Ejemplo n.º 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?
            }
        }
Ejemplo n.º 2
0
 public override object VisitMultipleLocalDeclarations(BoundMultipleLocalDeclarations node, object arg)
 {
     foreach (var v in node.LocalDeclarations)
     {
         Visit(v);
     }
     return(null);
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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?
            }
        }