System.Xml.Xsl.Qil.QilFactory.Choice C# (CSharp) Method

Choice() public method

public Choice ( QilNode expression, QilNode branches ) : QilChoice
expression QilNode
branches QilNode
return QilChoice
        public QilChoice Choice(QilNode expression, QilNode branches) {
            QilChoice n = new QilChoice(QilNodeType.Choice, expression, branches);
            n.XmlType = this.typeCheck.CheckChoice(n);
            TraceNode(n);
            return n;
        }
        

Usage Example

Exemplo n.º 1
0
        public QilNode Choice(QilNode expr, QilList branches)
        {
            if (!_debug)
            {
                switch (branches.Count)
                {
                case 1:
                    // If expr has no side effects, it will be eliminated by optimizer
                    return(_f.Loop(_f.Let(expr), branches[0]));

                case 2:
                    return(_f.Conditional(_f.Eq(expr, _f.LiteralInt32(0)), branches[0], branches[1]));
                }
            }
            return(_f.Choice(expr, branches));
        }