Beispiel #1
0
        private Call CreateCall(MethodDef method, Activation from)
        {
            ILInstruction[] instructions = method.GetMethodBody().Instructions.ToArray();

            Activation next;
            Call       currentCall = new Call(method, from, out next);

            if (from != null && from.Recieved != null)
            {
                currentCall.Caller = from.Recieved.RecievingActivation;
            }

            foreach (ILInstruction current in instructions)
            {
                if (current is InlineMethodILInstruction)
                {
                    InlineMethodILInstruction methodCall = current as InlineMethodILInstruction;
                    MemberRef calledMethod = methodCall.Method;
                    if (calledMethod is MethodDef)
                    {
                        this.CreateCall((MethodDef)calledMethod, next);
                    }
                }
            }
            return(currentCall);
        }