コード例 #1
0
        private BoundIfStatement BindIfStatement(IfStatementSyntax syntax)
        {
            BaseBoundExpression ifExpression = this.BindExpression(syntax.IfPart.Condition);
            BoundStatementBlock ifBody       = this.BindStatementBlock(syntax.IfPart.Body);
            BoundIfPart         ifPart       = new BoundIfPart(syntax.IfPart, ifExpression, ifBody);

            List <BoundElseIfPart> elseIfParts = new List <BoundElseIfPart>();

            foreach (var part in syntax.ElseIfParts)
            {
                BaseBoundExpression elseIfExpression = this.BindExpression(part.Condition);
                BoundStatementBlock elseIfBody       = this.BindStatementBlock(part.Body);
                elseIfParts.Add(new BoundElseIfPart(part, elseIfExpression, elseIfBody));
            }

            BoundElsePart elsePart = null;

            if (!syntax.ElsePartOpt.IsDefault())
            {
                BoundStatementBlock elseBody = this.BindStatementBlock(syntax.ElsePartOpt.Body);
                elsePart = new BoundElsePart(syntax.ElsePartOpt, elseBody);
            }

            return(new BoundIfStatement(syntax, ifPart, elseIfParts, elsePart));
        }
コード例 #2
0
        public BoundIfStatement(IfStatementSyntax syntax, BoundIfPart ifPart, IReadOnlyList <BoundElseIfPart> elseIfParts, BoundElsePart elsePartOpt)
        {
            Debug.Assert(!syntax.IsDefault(), "'syntax' must not be null.");
            Debug.Assert(!ifPart.IsDefault(), "'ifPart' must not be null.");
            Debug.Assert(!elseIfParts.IsDefault(), "'elseIfParts' must not be null.");

            this.Syntax      = syntax;
            this.IfPart      = ifPart;
            this.ElseIfParts = elseIfParts;
            this.ElsePartOpt = elsePartOpt;
        }
コード例 #3
0
 private protected virtual void VisitIfPart(BoundIfPart node)
 {
     this.DefaultVisit(node);
 }