Пример #1
0
        public IfStatementNode IfThenElse(ExpressionNode condition, BlockStatementNode trueStatement, IfStatementNode[] elseIfStatements, BlockStatementNode falseStatement, IEnumerable<AttributeNode> attributes)
        {
            if (condition == null)
                ThrowHelper.ThrowArgumentNullException(() => condition);
            if (trueStatement == null)
                ThrowHelper.ThrowArgumentNullException(() => trueStatement);

            if (falseStatement == null)
                falseStatement = EmptyBlock();

            if (elseIfStatements.Any())
            {
                var elseIf = elseIfStatements.First();
                falseStatement =
                    Block(
                        new StatementNodeBase[]{
                                                   IfThenElse(elseIf.ConditionExpression, elseIf.TrueStatementNode, elseIfStatements.Skip(1).ToArray(), new AttributeNode[0])
                                               }
                    );
            }

            return new IfStatementNode(condition, trueStatement, falseStatement, attributes);
        }
Пример #2
0
 public IfStatementNode IfThenElse(ExpressionNode condition, BlockStatementNode trueStatement, IfStatementNode[] elseIfStatements, IEnumerable<AttributeNode> attributes)
 {
     return IfThenElse(condition, trueStatement, elseIfStatements, EmptyBlock(), attributes);
 }