コード例 #1
0
 private void MoveIn(IfStatement gotoStatement, Statement targetStatement, string label)
 {
     V_0 = gotoStatement.get_Parent() as BlockStatement;
     V_1 = new VariableReferenceExpression(this.GetLabelVariable(label), null);
     this.ExtractConditionIntoVariable(V_1.CloneExpressionOnly() as VariableReferenceExpression, gotoStatement, V_0);
     V_2 = V_0.get_Statements().IndexOf(gotoStatement);
     V_3 = V_0.get_Statements().IndexOf(targetStatement);
     V_4 = this.CollectStatements(V_2 + 1, V_3, V_0);
     V_5 = new IfStatement(new UnaryExpression(1, V_1.CloneExpressionOnly(), null), V_4, null);
     if (V_5.get_Then().get_Statements().get_Count() > 0)
     {
         V_0.AddStatementAt(V_2, V_5);
     }
     dummyVar0 = V_0.get_Statements().Remove(gotoStatement);
     if (targetStatement as DoWhileStatement != null)
     {
         (targetStatement as DoWhileStatement).get_Body().AddStatementAt(0, gotoStatement);
         return;
     }
     if (targetStatement as IfStatement != null)
     {
         V_6 = targetStatement as IfStatement;
         V_6.set_Condition(this.UpdateCondition(V_6.get_Condition(), V_1.CloneExpressionOnly() as VariableReferenceExpression));
         V_6.get_Then().AddStatementAt(0, gotoStatement);
         return;
     }
     if (targetStatement as SwitchCase != null)
     {
         this.MoveInCase(gotoStatement, targetStatement as SwitchCase, label);
         return;
     }
     if (targetStatement as WhileStatement == null)
     {
         throw new NotSupportedException("Unsupported target statement for goto jump.");
     }
     V_7 = targetStatement as WhileStatement;
     V_7.get_Body().AddStatementAt(0, gotoStatement);
     V_7.set_Condition(this.UpdateCondition(V_7.get_Condition(), V_1.CloneExpressionOnly() as VariableReferenceExpression));
     return;
 }