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

Choice() public method

public Choice ( QilNode expr, QilList branches ) : QilNode
expr QilNode
branches QilList
return QilNode
        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);
        }