Наследование: Microsoft.Cci.MutableCodeModel.CodeRewriter
Пример #1
0
 /// <summary>
 /// Create method body of the MoveNext from a copy of the body of the iterator method.
 /// 
 /// First we substitute the locals/parameters with closure fields, and generic method type parameter of the iterator
 /// method with generic type parameters of the closure class (if any). 
 /// Then, we build the state machine. 
 /// </summary>
 private IBlockStatement TranslateIteratorMethodBodyToMoveNextBody(IteratorClosureInformation iteratorClosure, BlockStatement blockStatement) {
   var rewriter = new RewriteAsMoveNext(this.FieldForCapturedLocalOrParameter, this.iteratorLocalCount, this.genericTypeParameterMapping, iteratorClosure, this.host);
   rewriter.RewriteChildren(blockStatement);
   // State machine.
   Dictionary<int, ILabeledStatement> StateEntries = new YieldReturnYieldBreakReplacer(iteratorClosure, this.host).GetStateEntries(blockStatement);
   return BuildStateMachine(iteratorClosure, blockStatement, StateEntries);
 }