internal override int ParentToken(int token)
        {
            RuntimeType declaringType = null;
            object      obj2          = this.m_scope[token];

            if (obj2 is RuntimeMethodHandle)
            {
                declaringType = RuntimeMethodHandle.GetDeclaringType(((RuntimeMethodHandle)obj2).GetMethodInfo());
            }
            else if (obj2 is RuntimeFieldHandle)
            {
                declaringType = RuntimeFieldHandle.GetApproxDeclaringType(((RuntimeFieldHandle)obj2).GetRuntimeFieldInfo());
            }
            else if (obj2 is DynamicMethod)
            {
                DynamicMethod method = (DynamicMethod)obj2;
                declaringType = RuntimeMethodHandle.GetDeclaringType(method.m_methodHandle);
            }
            else if (obj2 is GenericMethodInfo)
            {
                GenericMethodInfo info = (GenericMethodInfo)obj2;
                declaringType = info.m_context.GetRuntimeType();
            }
            else if (obj2 is GenericFieldInfo)
            {
                GenericFieldInfo info2 = (GenericFieldInfo)obj2;
                declaringType = info2.m_context.GetRuntimeType();
            }
            else if (obj2 is VarArgMethod)
            {
                VarArgMethod  method2       = (VarArgMethod)obj2;
                DynamicMethod dynamicMethod = method2.m_dynamicMethod;
                if (dynamicMethod != null)
                {
                    dynamicMethod.GetMethodDescriptor();
                    declaringType = RuntimeMethodHandle.GetDeclaringType(dynamicMethod.m_methodHandle);
                }
                else
                {
                    RuntimeMethodInfo info3 = method2.m_method;
                    if (info3.DeclaringType == null)
                    {
                        declaringType = RuntimeMethodHandle.GetDeclaringType(info3);
                    }
                    else
                    {
                        declaringType = info3.DeclaringType.TypeHandle.GetRuntimeType();
                    }
                }
            }
            if (declaringType == null)
            {
                return(-1);
            }
            return(this.m_scope.GetTokenFor(declaringType.GetTypeHandleInternal()));
        }
예제 #2
0
        private int GetTokenForVarArgMethod(RuntimeMethodInfo rtMeth, SignatureHelper sig)
        {
#if FEATURE_APPX
            if (ProfileAPICheck && (rtMeth.InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != 0)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", rtMeth.FullName));
            }
#endif
            VarArgMethod varArgMeth = new VarArgMethod(rtMeth, sig);
            return(m_scope.GetTokenFor(varArgMeth));
        }
예제 #3
0
        // Token: 0x060048D9 RID: 18649 RVA: 0x001071B0 File Offset: 0x001053B0
        private int GetTokenForVarArgMethod(RuntimeMethodInfo rtMeth, SignatureHelper sig)
        {
            if (this.ProfileAPICheck && (rtMeth.InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != INVOCATION_FLAGS.INVOCATION_FLAGS_UNKNOWN)
            {
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", new object[]
                {
                    rtMeth.FullName
                }));
            }
            VarArgMethod varArgMethod = new VarArgMethod(rtMeth, sig);

            return(this.m_scope.GetTokenFor(varArgMethod));
        }
        // Token: 0x06004905 RID: 18693 RVA: 0x00107AD8 File Offset: 0x00105CD8
        internal byte[] ResolveSignature(int token, int fromMethod)
        {
            if (fromMethod == 0)
            {
                return((byte[])this[token]);
            }
            VarArgMethod varArgMethod = this[token] as VarArgMethod;

            if (varArgMethod == null)
            {
                return(null);
            }
            return(varArgMethod.m_signature.GetSignature(true));
        }
        internal override unsafe int ParentToken(int token)
        {
            RuntimeTypeHandle owner = RuntimeTypeHandle.EmptyHandle;

            Object handle = m_scope[token];

            if (handle is RuntimeMethodHandle)
            {
                RuntimeMethodHandle method = (RuntimeMethodHandle)handle;
                owner = method.GetDeclaringType();
            }
            else if (handle is RuntimeFieldHandle)
            {
                RuntimeFieldHandle field = (RuntimeFieldHandle)handle;
                owner = field.GetApproxDeclaringType();
            }
            else if (handle is DynamicMethod)
            {
                DynamicMethod dynMeth = (DynamicMethod)handle;
                owner = dynMeth.m_method.GetDeclaringType();
            }
            else if (handle is GenericMethodInfo)
            {
                GenericMethodInfo gmi = (GenericMethodInfo)handle;
                owner = gmi.m_context;
            }
            else if (handle is VarArgMethod)
            {
                VarArgMethod varargMeth = (VarArgMethod)handle;
                if (varargMeth.m_method is DynamicMethod)
                {
                    owner = ((DynamicMethod)varargMeth.m_method).m_method.GetDeclaringType();
                }
                else if (varargMeth.m_method is DynamicMethod.RTDynamicMethod)
                {
                    owner = ((DynamicMethod.RTDynamicMethod)varargMeth.m_method).m_owner.m_method.GetDeclaringType();
                }
                else
                {
                    owner = varargMeth.m_method.MethodHandle.GetDeclaringType();
                }
            }

            if (owner.IsNullHandle())
            {
                return(-1);
            }

            return(m_scope.GetTokenFor(owner));
        }
        internal override unsafe void *ResolveToken(int token)
        {
            object obj2 = this.m_scope[token];

            if (obj2 is RuntimeTypeHandle)
            {
                RuntimeTypeHandle handle = (RuntimeTypeHandle)obj2;
                return((void *)handle.Value);
            }
            if (obj2 is RuntimeMethodHandle)
            {
                RuntimeMethodHandle handle2 = (RuntimeMethodHandle)obj2;
                return((void *)handle2.Value);
            }
            if (obj2 is RuntimeFieldHandle)
            {
                RuntimeFieldHandle handle3 = (RuntimeFieldHandle)obj2;
                return((void *)handle3.Value);
            }
            if (obj2 is DynamicMethod)
            {
                DynamicMethod method = (DynamicMethod)obj2;
                return((void *)method.GetMethodDescriptor().Value);
            }
            if (obj2 is GenericMethodInfo)
            {
                GenericMethodInfo info = (GenericMethodInfo)obj2;
                return((void *)info.m_methodHandle.Value);
            }
            if (obj2 is GenericFieldInfo)
            {
                GenericFieldInfo info2 = (GenericFieldInfo)obj2;
                return((void *)info2.m_fieldHandle.Value);
            }
            if (!(obj2 is VarArgMethod))
            {
                return(null);
            }
            VarArgMethod method2 = (VarArgMethod)obj2;

            if (method2.m_dynamicMethod == null)
            {
                return((void *)method2.m_method.MethodHandle.Value);
            }
            return((void *)method2.m_dynamicMethod.GetMethodDescriptor().Value);
        }
        internal override unsafe void *ResolveToken(int token)
        {
            Object handle = m_scope[token];

            if (handle is RuntimeTypeHandle)
            {
                RuntimeTypeHandle typeHandle = (RuntimeTypeHandle)handle;
                return((void *)typeHandle.Value);
            }
            else if (handle is RuntimeMethodHandle)
            {
                RuntimeMethodHandle methodHandle = (RuntimeMethodHandle)handle;
                return((void *)methodHandle.Value);
            }
            else if (handle is RuntimeFieldHandle)
            {
                RuntimeFieldHandle fieldHandle = (RuntimeFieldHandle)handle;
                return((void *)fieldHandle.Value);
            }
            else if (handle is DynamicMethod)
            {
                DynamicMethod       dynMeth      = (DynamicMethod)handle;
                RuntimeMethodHandle methodHandle = dynMeth.GetMethodDescriptor();
                return((void *)methodHandle.Value);
            }
            else if (handle is GenericMethodInfo)
            {
                GenericMethodInfo gmi = (GenericMethodInfo)handle;
                return((void *)gmi.m_method.Value);
            }
            else if (handle is VarArgMethod)
            {
                VarArgMethod  vaMeth = (VarArgMethod)handle;
                DynamicMethod dm     = vaMeth.m_method as DynamicMethod;
                if (dm == null)
                {
                    return((void *)vaMeth.m_method.MethodHandle.Value);
                }
                else
                {
                    return((void *)dm.GetMethodDescriptor().Value);
                }
            }

            return(null);
        }
예제 #8
0
        private int GetTokenForVarArgMethod(RuntimeMethodInfo rtMeth, SignatureHelper sig)
        {
            VarArgMethod varArgMeth = new VarArgMethod(rtMeth, sig);

            return(m_scope.GetTokenFor(varArgMeth));
        }
예제 #9
0
        private int GetTokenForVarArgMethod(DynamicMethod dm, SignatureHelper sig)
        {
            VarArgMethod varArgMeth = new VarArgMethod(dm, sig);

            return(m_scope.GetTokenFor(varArgMeth));
        }
예제 #10
0
 private int GetTokenForVarArgMethod(DynamicMethod dm, SignatureHelper sig)
 {
     VarArgMethod varArgMeth = new VarArgMethod(dm, sig);
     return m_scope.GetTokenFor(varArgMeth);
 }
예제 #11
0
 internal int GetTokenFor(VarArgMethod varArgMethod)
 {
     m_tokens.Add(varArgMethod);
     return(m_tokens.Count - 1 | (int)MetadataTokenType.MemberRef);
 }
예제 #12
0
 internal int GetTokenFor(VarArgMethod varArgMethod)
 {
     m_tokens.Add(varArgMethod);
     return m_tokens.Count - 1 | (int)MetadataTokenType.MemberRef;
 }
예제 #13
0
        private int GetTokenForVarArgMethod(RuntimeMethodInfo rtMeth, SignatureHelper sig)
        {
#if FEATURE_APPX
            if (ProfileAPICheck && (rtMeth.InvocationFlags & INVOCATION_FLAGS.INVOCATION_FLAGS_NON_W8P_FX_API) != 0)
                throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_APIInvalidForCurrentContext", rtMeth.FullName));
#endif
            VarArgMethod varArgMeth = new VarArgMethod(rtMeth, sig);
            return m_scope.GetTokenFor(varArgMeth);
        }
예제 #14
0
        internal override void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle)
        {
            typeHandle   = new IntPtr();
            methodHandle = new IntPtr();
            fieldHandle  = new IntPtr();

            Object handle = m_scope[token];

            if (handle == null)
            {
                throw new InvalidProgramException();
            }

            if (handle is RuntimeTypeHandle)
            {
                typeHandle = ((RuntimeTypeHandle)handle).Value;
                return;
            }

            if (handle is RuntimeMethodHandle)
            {
                methodHandle = ((RuntimeMethodHandle)handle).Value;
                return;
            }

            if (handle is RuntimeFieldHandle)
            {
                fieldHandle = ((RuntimeFieldHandle)handle).Value;
                return;
            }

            DynamicMethod dm = handle as DynamicMethod;

            if (dm != null)
            {
                methodHandle = dm.GetMethodDescriptor().Value;
                return;
            }

            GenericMethodInfo gmi = handle as GenericMethodInfo;

            if (gmi != null)
            {
                methodHandle = gmi.m_methodHandle.Value;
                typeHandle   = gmi.m_context.Value;
                return;
            }

            GenericFieldInfo gfi = handle as GenericFieldInfo;

            if (gfi != null)
            {
                fieldHandle = gfi.m_fieldHandle.Value;
                typeHandle  = gfi.m_context.Value;
                return;
            }

            VarArgMethod vaMeth = handle as VarArgMethod;

            if (vaMeth != null)
            {
                if (vaMeth.m_dynamicMethod == null)
                {
                    methodHandle = vaMeth.m_method.MethodHandle.Value;
                    typeHandle   = vaMeth.m_method.GetDeclaringTypeInternal().GetTypeHandleInternal().Value;
                }
                else
                {
                    methodHandle = vaMeth.m_dynamicMethod.GetMethodDescriptor().Value;
                }

                return;
            }
        }
예제 #15
0
 internal int GetTokenFor(VarArgMethod varArgMethod)
 {
     this.m_tokens.Add(varArgMethod);
     return((this.m_tokens.Count - 1) | 0xa000000);
 }
 internal int GetTokenFor(VarArgMethod varArgMethod)
 {
     this.m_tokens.Add(varArgMethod);
     return ((this.m_tokens.Count - 1) | 0xa000000);
 }
 // Token: 0x06004903 RID: 18691 RVA: 0x00107AA9 File Offset: 0x00105CA9
 internal int GetTokenFor(VarArgMethod varArgMethod)
 {
     this.m_tokens.Add(varArgMethod);
     return(this.m_tokens.Count - 1 | 167772160);
 }
예제 #18
0
        internal override void ResolveToken(int token, out IntPtr typeHandle, out IntPtr methodHandle, out IntPtr fieldHandle)
        {
            typeHandle   = new IntPtr();
            methodHandle = new IntPtr();
            fieldHandle  = new IntPtr();
            object obj = this.m_scope[token];

            if (obj == null)
            {
                throw new InvalidProgramException();
            }
            if (obj is RuntimeTypeHandle)
            {
                typeHandle = ((RuntimeTypeHandle)obj).Value;
            }
            else if (obj is RuntimeMethodHandle)
            {
                methodHandle = ((RuntimeMethodHandle)obj).Value;
            }
            else if (obj is RuntimeFieldHandle)
            {
                fieldHandle = ((RuntimeFieldHandle)obj).Value;
            }
            else
            {
                DynamicMethod dynamicMethod = obj as DynamicMethod;
                if ((MethodInfo)dynamicMethod != (MethodInfo)null)
                {
                    methodHandle = dynamicMethod.GetMethodDescriptor().Value;
                }
                else
                {
                    GenericMethodInfo genericMethodInfo = obj as GenericMethodInfo;
                    if (genericMethodInfo != null)
                    {
                        methodHandle = genericMethodInfo.m_methodHandle.Value;
                        typeHandle   = genericMethodInfo.m_context.Value;
                    }
                    else
                    {
                        GenericFieldInfo genericFieldInfo = obj as GenericFieldInfo;
                        if (genericFieldInfo != null)
                        {
                            fieldHandle = genericFieldInfo.m_fieldHandle.Value;
                            typeHandle  = genericFieldInfo.m_context.Value;
                        }
                        else
                        {
                            VarArgMethod varArgMethod = obj as VarArgMethod;
                            if (varArgMethod == null)
                            {
                                return;
                            }
                            if ((MethodInfo)varArgMethod.m_dynamicMethod == (MethodInfo)null)
                            {
                                methodHandle = varArgMethod.m_method.MethodHandle.Value;
                                typeHandle   = varArgMethod.m_method.GetDeclaringTypeInternal().GetTypeHandleInternal().Value;
                            }
                            else
                            {
                                methodHandle = varArgMethod.m_dynamicMethod.GetMethodDescriptor().Value;
                            }
                        }
                    }
                }
            }
        }