Exemplo n.º 1
0
 // *****************************************************************************
 // public methods
 // *****************************************************************************
 public static Statement IsHead(Statement head)
 {
     if (head.type == Type_Basicblock && head.GetLastBasicType() == Lastbasictype_If)
     {
         int       regsize = head.GetSuccessorEdges(StatEdge.Type_Regular).Count;
         Statement p       = null;
         bool      ok      = (regsize < 2);
         if (!ok)
         {
             List <Statement> lst = new List <Statement>();
             if (DecHelper.IsChoiceStatement(head, lst))
             {
                 p = lst.RemoveAtReturningValue(0);
                 foreach (Statement st in lst)
                 {
                     if (st.IsMonitorEnter())
                     {
                         return(null);
                     }
                 }
                 ok = DecHelper.CheckStatementExceptions(lst);
             }
         }
         if (ok)
         {
             return(new IfStatement(head, regsize, p));
         }
     }
     return(null);
 }
Exemplo n.º 2
0
 // *****************************************************************************
 // public methods
 // *****************************************************************************
 public static Statement IsHead(Statement head)
 {
     if (head.type == Statement.Type_Basicblock && head.GetLastBasicType() == Statement
         .Lastbasictype_Switch)
     {
         List <Statement> lst = new List <Statement>();
         if (DecHelper.IsChoiceStatement(head, lst))
         {
             Statement post = lst.RemoveAtReturningValue(0);
             foreach (Statement st in lst)
             {
                 if (st.IsMonitorEnter())
                 {
                     return(null);
                 }
             }
             if (DecHelper.CheckStatementExceptions(lst))
             {
                 return(new SwitchStatement(head, post));
             }
         }
     }
     return(null);
 }