Exemplo n.º 1
0
 public InspectionPass(MethodDefinition method, BranchDecider branchDecider, InspectedStack stack, IInspectionVisitor inspectionVisitor)
 {
     _method = method;
       _inspectionVisitor = inspectionVisitor;
       _branchDecider = branchDecider;
       _stack = stack;
 }
Exemplo n.º 2
0
        public virtual IEnumerable <InspectionPass> Inspect(MethodDefinition method, IInspectionVisitor visitor)
        {
            List <InspectionPass> passes        = new List <InspectionPass>();
            BranchDecider         branchDecider = new BranchDecider();

            do
            {
                InspectionPass pass = new InspectionPass(method, branchDecider, new InspectedStack(), visitor);
                Inspect(pass, method.Body.Instructions[0]);
                if (pass.Stack.Count > 0)
                {
                    throw new ArgumentException("CodeInspector failed, non-empty stack: " + method + " has " + pass.Stack.Count);
                }
                passes.Add(pass);
            }while (!branchDecider.IsDone);
            return(passes);
        }