private void StartLoop(XmlQueryType typ, XmlILConstructInfo info) {
Debug.Assert(!typ.IsSingleton);
// This is tricky, because the looping introduces a feedback loop:
// 1. Because loops may be executed many times, the beginning set of states must include the ending set of states.
// 2. Because loops may be executed 0 times, the final set of states after all looping is complete must include
// the initial set of states.
//
// +-- states-initial
// | |
// | states-begin-loop <--+
// | | |
// | +--------------+ |
// | | Construction | |
// | +--------------+ |
// | | |
// | states-end-loop ----+
// | |
// +--> states-final
// Save starting loop states
info.BeginLoopStates = this.xstates;
if (typ.MaybeMany) {
// If transition might occur from EnumAttrs to WithinContent, then states-end might be WithinContent, which
// means states-begin needs to also include WithinContent.
if (this.xstates == PossibleXmlStates.EnumAttrs && MaybeContent(typ))
info.BeginLoopStates = this.xstates = PossibleXmlStates.Any;
}
}