public void TransformIteration(ForStatement node)
 {
     string[] textArray1 = new string[] { "iterator" };
     InternalLocal iteratorVariable = this.get_CodeBuilder().DeclareLocal(this.get_CurrentMethod(), base._context.GetUniqueName(textArray1), this.get_TypeSystemServices().IEnumeratorType);
     iteratorVariable.set_IsUsed(true);
     Block block = new Block(node.get_LexicalInfo());
     block.Add(this.get_CodeBuilder().CreateAssignment(node.get_LexicalInfo(), this.get_CodeBuilder().CreateReference(iteratorVariable), node.get_Iterator()));
     WhileStatement statement = new WhileStatement(node.get_LexicalInfo());
     statement.set_Condition(this.get_CodeBuilder().CreateMethodInvocation(this.get_CodeBuilder().CreateReference(iteratorVariable), this.IEnumerator_MoveNext));
     MethodInvocationExpression expression = this.get_CodeBuilder().CreateMethodInvocation(this.get_CodeBuilder().CreateReference(iteratorVariable), this.IEnumerator_get_Current);
     InternalLocal entity = TypeSystemServices.GetEntity(node.get_Declarations().get_Item(0));
     statement.get_Block().Add(this.get_CodeBuilder().CreateAssignment(node.get_LexicalInfo(), this.get_CodeBuilder().CreateReference(entity), expression));
     statement.get_Block().Add(node.get_Block());
     new LoopVariableUpdater(this, base._context, iteratorVariable, entity).Visit(node);
     block.Add(statement);
     node.get_ParentNode().Replace(node, block);
 }
 public void ProcessUpdateableIteration(ForStatement node)
 {
     Expression expression = node.get_Iterator();
     MethodInvocationExpression expression2 = this.get_CodeBuilder().CreateMethodInvocation(this._UnityRuntimeServices_GetEnumerator, node.get_Iterator());
     expression2.set_LexicalInfo(new LexicalInfo(node.get_Iterator().get_LexicalInfo()));
     node.set_Iterator(expression2);
     this.ProcessDeclarationForIterator(node.get_Declarations().get_Item(0), this.GetEnumeratorItemType(this.GetExpressionType(expression)));
     this.VisitForStatementBlock(node);
     this.TransformIteration(node);
 }
 public override void OnForStatement(ForStatement node)
 {
     if (1 != node.get_Declarations().Count)
     {
         throw new AssertionFailedException("1 == len(node.Declarations)");
     }
     this.Visit(node.get_Iterator());
     if (this.NeedsUpdateableIteration(node))
     {
         this.ProcessUpdateableIteration(node);
     }
     else
     {
         this.ProcessNormalIteration(node);
     }
 }
 public void ProcessNormalIteration(ForStatement node)
 {
     node.set_Iterator(this.ProcessIterator(node.get_Iterator(), node.get_Declarations()));
     this.VisitForStatementBlock(node);
 }
 public bool NeedsUpdateableIteration(ForStatement node)
 {
     return !this.GetExpressionType(node.get_Iterator()).get_IsArray();
 }