System.Xml.Xsl.IlGen.XmlILVisitor.ConditionalBranch C# (CSharp) Method

ConditionalBranch() private method

Generate code for one of the branches of QilNodeType.Conditional.
private ConditionalBranch ( QilNode ndBranch, Type itemStorageType, LocalBuilder locResult ) : void
ndBranch QilNode
itemStorageType System.Type
locResult System.Reflection.Emit.LocalBuilder
return void
        private void ConditionalBranch(QilNode ndBranch, Type itemStorageType, LocalBuilder locResult) {
            if (locResult == null) {
                Debug.Assert(ndBranch.XmlType.IsSingleton, "Conditional must produce a singleton");

                // If in a branching context, then inherit branch target from parent context
                if (this.iterCurr.IsBranching) {
                    Debug.Assert(itemStorageType == typeof(bool));
                    NestedVisitWithBranch(ndBranch, this.iterCurr.CurrentBranchingContext, this.iterCurr.LabelBranch);
                }
                else {
                    NestedVisitEnsureStack(ndBranch, itemStorageType, false);
                }
            }
            else {
                // Link nested iterator to parent conditional's iterator
                NestedVisit(ndBranch, this.iterCurr.GetLabelNext());
                this.iterCurr.EnsureItemStorageType(ndBranch.XmlType, itemStorageType);
                this.iterCurr.EnsureLocalNoCache(locResult);
            }
        }
XmlILVisitor