示例#1
0
 protected override bool CheckTheLoop(WhileStatement theWhile, VariableReference forVariable)
 {
     if (!this.CheckTheLoop(theWhile, forVariable))
     {
         stackVariable4 = false;
     }
     else
     {
         stackVariable4 = theWhile.get_Condition() as BinaryExpression != null;
     }
     if (!stackVariable4)
     {
         return(false);
     }
     V_0 = (theWhile.get_Body().get_Statements().get_Item(theWhile.get_Body().get_Statements().get_Count() - 1) as ExpressionStatement).get_Expression() as BinaryExpression;
     if (V_0 != null)
     {
         V_1 = V_0.get_Right() as BinaryExpression;
         if (V_1 != null && V_1.get_Operator() == 1 || V_1.get_Operator() == 3)
         {
             V_2 = V_1.get_Left() as VariableReferenceExpression;
             if (V_2 != null && (object)V_2.get_Variable() == (object)forVariable)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#2
0
 public override void VisitWhileStatement(WhileStatement node)
 {
     this.TryProcessConditionStatement(node);
     this.states.Push(2);
     this.Visit(node.get_Condition());
     dummyVar0 = this.states.Pop();
     this.Visit(node.get_Body());
     if (this.processStep == RemoveConditionOnlyVariables.ProcessStep.Search)
     {
         this.SetVariablesExpressionStatements(node);
     }
     return;
 }
示例#3
0
 protected virtual bool CheckTheLoop(WhileStatement theWhile, VariableReference forVariable)
 {
     if (theWhile == null || theWhile.get_Body().get_Statements().get_Count() < 2)
     {
         return(false);
     }
     if (!(new VariableFinder(forVariable)).FindVariable(theWhile.get_Condition()))
     {
         return(false);
     }
     V_0 = theWhile.get_Body().get_Statements().get_Item(theWhile.get_Body().get_Statements().get_Count() - 1) as ExpressionStatement;
     if (V_0 == null || !this.TryGetAssignedVariable(V_0, out V_1) || (object)forVariable != (object)V_1)
     {
         return(false);
     }
     return(!(new RebuildForStatements.ContinueFinder()).FindContinue(theWhile.get_Body()));
 }
示例#4
0
 public virtual void VisitWhileStatement(WhileStatement node)
 {
     this.Visit(node.get_Condition());
     this.Visit(node.get_Body());
     return;
 }
示例#5
0
 private ForStatement CreateForStatement(Statement initializer, WhileStatement theWhile)
 {
     V_0 = theWhile.get_Body().get_Statements().get_Count() - 1;
     V_1 = theWhile.get_Body().get_Statements().get_Item(V_0).get_Label();
     V_2 = new ForStatement((initializer as ExpressionStatement).get_Expression(), theWhile.get_Condition(), (theWhile.get_Body().get_Statements().get_Item(V_0) as ExpressionStatement).get_Expression(), new BlockStatement());
     V_3 = 0;
     while (V_3 < V_0)
     {
         V_2.get_Body().AddStatement(theWhile.get_Body().get_Statements().get_Item(V_3));
         V_3 = V_3 + 1;
     }
     if (!String.IsNullOrEmpty(V_1))
     {
         stackVariable42 = new EmptyStatement();
         stackVariable42.set_Label(V_1);
         V_2.get_Body().AddStatement(stackVariable42);
     }
     return(V_2);
 }
 public virtual ICodeNode VisitWhileStatement(WhileStatement node)
 {
     node.set_Condition((Expression)this.Visit(node.get_Condition()));
     node.set_Body((BlockStatement)this.Visit(node.get_Body()));
     return(node);
 }