private void EndNestedIterator(QilNode nd) {
Debug.Assert(this.iterCurr.Storage.Location == ItemLocation.None ||
this.iterCurr.Storage.ItemStorageType == GetItemStorageType(nd) ||
this.iterCurr.Storage.ItemStorageType == typeof(XPathItem) ||
nd.XmlType.TypeCode == XmlTypeCode.None,
"QilNodeType " + nd.NodeType + " cannot be stored using type " + this.iterCurr.Storage.ItemStorageType + ".");
// If the nested iterator was constructed in branching mode,
if (this.iterCurr.IsBranching) {
// Then if branching hasn't already taken place, do so now
if (this.iterCurr.Storage.Location != ItemLocation.None) {
this.iterCurr.EnsureItemStorageType(nd.XmlType, typeof(bool));
this.iterCurr.EnsureStackNoCache();
if (this.iterCurr.CurrentBranchingContext == BranchingContext.OnTrue)
this.helper.Emit(OpCodes.Brtrue, this.iterCurr.LabelBranch);
else
this.helper.Emit(OpCodes.Brfalse, this.iterCurr.LabelBranch);
this.iterCurr.Storage = StorageDescriptor.None();
}
}
// Save current iterator as nested iterator
this.iterNested = this.iterCurr;
// Update current iterator to be parent iterator
this.iterCurr = this.iterCurr.ParentIterator;
}