Esempio n. 1
0
        public override BoundNode VisitForStatement(ForStatementSyntax node)
        {
            BoundVariableDeclarationStatement declaration = null;

            if (node.Declaration != null)
            {
                declaration = (BoundVariableDeclarationStatement)VisitVariableDeclaration(node.Declaration);
            }

            BoundExpression[] initializers = new BoundExpression[node.Initializers.Count];

            for (int i = 0; i < initializers.Length; ++i)
            {
                initializers[i] = VisitExpression(node.Initializers[i]);
            }

            BoundExpression conditionExpression = null;

            if (node.Condition != null)
            {
                conditionExpression = VisitExpression(node.Condition, typeof(bool));
            }

            var incrementors = new BoundExpression[node.Incrementors.Count];

            for (int i = 0; i < incrementors.Length; ++i)
            {
                incrementors[i] = VisitExpression(node.Incrementors[i]);
            }

            var body = VisitStatement(node.Statement);

            return(new BoundForStatement(node, declaration, initializers, conditionExpression, incrementors, body));
        }
Esempio n. 2
0
 public BoundForStatement(SyntaxNode node, BoundVariableDeclarationStatement declaration, BoundExpression[] initializers, BoundExpression condition, BoundExpression[] incrementors, BoundStatement body)
     : base(node)
 {
     Declaration  = declaration;
     Initializers = initializers;
     Condition    = condition;
     Incrementors = incrementors;
     Body         = body;
 }
 public BoundLocalDeclarationStatement(LocalDeclarationStatementSyntax node, BoundVariableDeclarationStatement declarationStatement)
     : base(node)
 {
     DeclarationStatement = declarationStatement;
 }