Exemple #1
0
        public MethodConverter(Delegate del, MemberConverter memberConverter, bool hasThis = false)
        {
            var meth = del.Method;

            _name            = meth.Name;
            _memberConverter = memberConverter;
            _methodSig       = memberConverter.MethodInfoToMethodSig(meth, hasThis);
            _parameters      = new List <ParameterInfo>(meth.GetParameters());
            _returnType      = meth.ReturnType;
            _bodyConverter   = new BodyConverter(del, memberConverter);
            _hasThis         = hasThis;
        }
Exemple #2
0
        public BodyConverter(Delegate del, MemberConverter memberConverter)
        {
            var methBody = del.Method.GetMethodBody() ?? throw new Exception("Unable to get method body!");

            _parameters = del.Method.GetParameters();
            _locals     = methBody.LocalVariables;
            _handlers   = methBody.ExceptionHandlingClauses;
            _body       = methBody.GetILAsByteArray();
            _initLocals = methBody.InitLocals;

            _patchModule     = del.Method.Module;
            _memberConverter = memberConverter;

            _decreaseLdargRank = (del.Method.Attributes & System.Reflection.MethodAttributes.Static) == 0;             // not static

            Result = null;
        }