Exemple #1
0
 private Statement GetSameLevelParent(Statement labeledStatement, IfStatement gotoStatement)
 {
     V_0 = this.GetParentsChain(labeledStatement);
     V_1 = gotoStatement.get_Parent() as BlockStatement;
     while (!V_1.get_Statements().Contains(V_0.Peek()))
     {
         dummyVar0 = V_0.Pop();
     }
     return(V_0.Peek());
 }
Exemple #2
0
 private Statement GetLowestCommonParent(Statement first, Statement second)
 {
     V_0 = this.GetParentsChain(first);
     V_1 = this.GetParentsChain(second);
     V_2 = null;
     while (V_0.Peek() == V_1.Peek())
     {
         V_2       = V_0.Pop();
         dummyVar0 = V_1.Pop();
     }
     return(V_2);
 }
Exemple #3
0
        private bool Precedes(Statement first, Statement second)
        {
            V_0 = this.GetParentsChain(first);
            V_1 = this.GetParentsChain(second);
            V_2 = null;
            while (V_0.Peek() == V_1.Peek())
            {
                V_2       = V_0.Pop();
                dummyVar0 = V_1.Pop();
            }
            if (V_2 as SwitchStatement == null)
            {
                if (V_2 as BlockStatement == null)
                {
                    throw new ArgumentException("No common block found.");
                }
                V_3 = (V_2 as BlockStatement).get_Statements().IndexOf(V_0.Peek());
                V_4 = (V_2 as BlockStatement).get_Statements().IndexOf(V_1.Peek());
                return(V_3 < V_4);
            }
            V_5 = (V_2 as SwitchStatement).get_Cases().GetEnumerator();
            try
            {
                while (V_5.MoveNext())
                {
                    if (V_5.get_Current() != V_0.Peek())
                    {
                        continue;
                    }
                    V_6 = true;
                    goto Label1;
                }
                goto Label0;
            }
            finally
            {
                if (V_5 != null)
                {
                    V_5.Dispose();
                }
            }
Label1:
            return(V_6);

Label0:
            return(false);
        }
        protected bool RemoveControllerChain()
        {
            V_0 = this.InitializeTheTraversalQueue();
            while (V_0.get_Count() > 0)
            {
                V_1 = V_0.Dequeue();
                V_2 = V_1;
                while (this.IsStateMachineControllerBlock(ref V_2, out V_4, out V_3))
                {
                    switch (V_4 - 1)
                    {
                    case 0:
                    {
                        V_6 = this.theCFG.get_SwitchBlocksInformation().get_Item(V_2);
                        V_7 = V_6.get_OrderedCasesArray();
                        V_8 = 0;
                        while (V_8 < (int)V_7.Length)
                        {
                            if (!this.toBeRemoved.Contains(V_7[V_8]))
                            {
                                V_9 = this.TryGetStateEntry(V_7[V_8], out V_5);
                                switch (V_9)
                                {
                                case 0:
                                {
                                    return(false);
                                }

                                case 1:
                                {
                                    this.stateToStartBlock[V_8 + V_3] = V_5;
                                    break;
                                }

                                case 2:
                                {
                                    this.stateToStartBlock[V_8 + V_3] = V_5;
                                    V_0.Enqueue(V_5);
                                    break;
                                }
                                }
                            }
                            V_8 = V_8 + 1;
                        }
                        V_0.Enqueue(this.SkipBranchChain(V_6.get_DefaultCase()));
                        break;
                    }

                    case 1:
                    {
                        V_9 = this.TryGetStateEntry(V_2.get_Successors()[0], out V_10);
                        switch (V_9)
                        {
                        case 0:
                        {
                            return(false);
                        }

                        case 1:
                        {
                            this.stateToStartBlock[V_3] = V_10;
                            break;
                        }

                        case 2:
                        {
                            this.stateToStartBlock[V_3] = V_10;
                            V_0.Enqueue(V_10);
                            break;
                        }
                        }
                        break;
                    }

                    case 2:
                    {
                        V_12 = 1;
                        if (V_3 == -1)
                        {
                            V_3  = 0;
                            V_12 = 0;
                        }
                        V_9 = this.TryGetStateEntry(V_2.get_Successors()[V_12], out V_11);
                        if (V_9 == StateControllerRemover.ControllerTraversalSearchResult.PatternFailed)
                        {
                            return(false);
                        }
                        if (V_9 - 1 > 1)
                        {
                            break;
                        }
                        this.stateToStartBlock[V_3] = V_11;
                        break;
                    }
                    }
                    dummyVar0 = this.toBeRemoved.Add(V_2);
                    if (V_4 != 3)
                    {
                        V_2 = V_2.get_Successors()[(int)V_2.get_Successors().Length - 1];
                    }
                    else
                    {
                        V_2 = V_2.get_Successors()[0];
                    }
                    V_2 = this.SkipBranchChain(V_2);
                }
                if (InstructionBlock.op_Equality(this.defaultStateEntry, null))
                {
                    this.defaultStateEntry = V_2;
                }
                this.ReattachDefaultSuccessor(V_1, V_2);
                while (V_0.get_Count() > 0 && this.toBeRemoved.Contains(V_0.Peek()))
                {
                    dummyVar1 = V_0.Dequeue();
                }
            }
            if (this.toBeRemoved.get_Count() == 0)
            {
                return(false);
            }
            this.CreateControllerSwitchData();
            return(true);
        }