Exemple #1
0
 private void ProcessBlock(BlockStatement node)
 {
     V_0 = 0;
     while (V_0 < node.get_Statements().get_Count() - 1)
     {
         V_1 = new RebuildForeachArrayStatements.ForeachArrayMatcher(node.get_Statements().get_Item(V_0), node.get_Statements().get_Item(V_0 + 1), this.context.get_MethodContext());
         if (V_1.Match() && !this.CheckForIndexUsages(V_1))
         {
             this.context.get_MethodContext().RemoveVariable(V_1.get_Incrementor());
             if (V_1.get_CurrentVariable() != null)
             {
                 this.context.get_MethodContext().RemoveVariable(V_1.get_CurrentVariable());
             }
             node.get_Statements().RemoveAt(V_0);
             node.get_Statements().RemoveAt(V_0);
             node.AddStatementAt(V_0, V_1.get_Foreach());
             this.ProcessBlock(V_1.get_Foreach().get_Body());
         }
         V_0 = V_0 + 1;
     }
     return;
 }
Exemple #2
0
 private bool CheckForIndexUsages(RebuildForeachArrayStatements.ForeachArrayMatcher matcher)
 {
     this.currentForIndeces.Push(matcher.get_Incrementor());
     this.currentForIndecesUsed.Push(false);
     V_0 = matcher.get_Foreach().get_Body().get_Statements().GetEnumerator();
     try
     {
         while (V_0.MoveNext())
         {
             V_1 = V_0.get_Current();
             this.Visit(V_1);
         }
     }
     finally
     {
         if (V_0 != null)
         {
             V_0.Dispose();
         }
     }
     dummyVar0 = this.currentForIndeces.Pop();
     return(this.currentForIndecesUsed.Pop());
 }