示例#1
0
        public IMemberSignature ReadMemberRefSignature(uint sig, IGenericContext context)
        {
            IMemberSignature    signature = null;
            BlobSignatureReader reader;

            if (TryGetBlobReader(sig, context, out reader))
            {
                using (reader)
                {
                    byte flag = reader.ReadByte();

                    if (flag == 0x6)
                    {
                        FieldSignature fieldsignature = new FieldSignature();
                        fieldsignature.ReturnType = reader.ReadTypeReference((ElementType)reader.ReadByte());
                        signature = fieldsignature;
                    }
                    else
                    {
                        MethodSignature methodsignature = new MethodSignature();

                        if ((flag & 0x20) != 0)
                        {
                            methodsignature.HasThis = true;
                            flag = (byte)(flag & -33);
                        }
                        if ((flag & 0x40) != 0)
                        {
                            methodsignature.ExplicitThis = true;
                            flag = (byte)(flag & -65);
                        }
                        if ((flag & 0x10) != 0)
                        {
                            int genericsig = NETGlobals.ReadCompressedInt32(reader);
                            if (!context.IsDefinition)
                            {
                                AddMissingGenericParameters(context.Method, genericsig - 1);
                            }
                        }
                        methodsignature.CallingConvention = (MethodCallingConvention)flag;

                        uint paramCount = NETGlobals.ReadCompressedUInt32(reader);
                        methodsignature.ReturnType = reader.ReadTypeReference();

                        ParameterReference[] parameters = new ParameterReference[paramCount];
                        for (int i = 0; i < paramCount; i++)
                        {
                            parameters[i] = new ParameterReference()
                            {
                                ParameterType = reader.ReadTypeReference((ElementType)reader.ReadByte())
                            };
                        }
                        methodsignature.Parameters = parameters;

                        signature = methodsignature;
                    }
                }
            }
            return(signature);
        }
示例#2
0
 public override void LoadCache()
 {
     _signature = Signature;
     _declaringType = DeclaringType;
     _name = Name;
 }
示例#3
0
 public override void ClearCache()
 {
     _signature = null;
     _declaringType = null;
     _name = null;
 }
示例#4
0
 public override void LoadCache()
 {
     _signature     = Signature;
     _declaringType = DeclaringType;
     _name          = Name;
 }
示例#5
0
 public override void ClearCache()
 {
     _signature     = null;
     _declaringType = null;
     _name          = null;
 }
示例#6
0
        public IMemberSignature ReadMemberRefSignature(uint sig, IGenericContext context)
        {
            IMemberSignature signature = null;
            BlobSignatureReader reader;
            if (TryGetBlobReader(sig, context, out reader))
            {
                using (reader)
                {
                    byte flag = reader.ReadByte();

                    if (flag == 0x6)
                    {
                        FieldSignature fieldsignature = new FieldSignature();
                        fieldsignature.ReturnType = reader.ReadTypeReference((ElementType)reader.ReadByte());
                        signature = fieldsignature;
                    }
                    else
                    {
                        MethodSignature methodsignature = new MethodSignature();

                        if ((flag & 0x20) != 0)
                        {
                            methodsignature.HasThis = true;
                            flag = (byte)(flag & -33);
                        }
                        if ((flag & 0x40) != 0)
                        {
                            methodsignature.ExplicitThis = true;
                            flag = (byte)(flag & -65);
                        }
                        if ((flag & 0x10) != 0)
                        {
                            int genericsig = NETGlobals.ReadCompressedInt32(reader);
                            if (!context.IsDefinition)
                            {
                                AddMissingGenericParameters(context.Method, genericsig - 1);
                            }
                        }
                        methodsignature.CallingConvention = (MethodCallingConvention)flag;

                        uint paramCount = NETGlobals.ReadCompressedUInt32(reader);
                        methodsignature.ReturnType = reader.ReadTypeReference();

                        ParameterReference[] parameters = new ParameterReference[paramCount];
                        for (int i = 0; i < paramCount; i++)
                        {
                            parameters[i] = new ParameterReference() { ParameterType = reader.ReadTypeReference((ElementType)reader.ReadByte()) };
                        }
                        methodsignature.Parameters = parameters;

                        signature = methodsignature;
                    }
                }
            }
            return signature;
        }