private void StartBinding(QilIterator ndIter) {
OptimizerPatterns patt = OptimizerPatterns.Read(ndIter);
Debug.Assert(ndIter != null);
// DebugInfo: Sequence point just before generating code for the bound expression
if (this.qil.IsDebug && ndIter.SourceLine != null)
this.helper.DebugSequencePoint(ndIter.SourceLine);
// Treat cardinality one Let iterators as if they were For iterators (no nesting necessary)
if (ndIter.NodeType == QilNodeType.For || ndIter.XmlType.IsSingleton) {
StartForBinding(ndIter, patt);
}
else {
Debug.Assert(ndIter.NodeType == QilNodeType.Let || ndIter.NodeType == QilNodeType.Parameter);
Debug.Assert(!patt.MatchesPattern(OptimizerPatternName.IsPositional));
// Bind Let values (nested iterator) to variable
StartLetBinding(ndIter);
}
// Attach IteratorDescriptor to the iterator
XmlILAnnotation.Write(ndIter).CachedIteratorDescriptor = this.iterNested;
}