Inheritance: MemberSignature
Exemplo n.º 1
0
        public static CallingConventionSignature FromReader(MetadataImage image, IBinaryStreamReader reader)
        {
            var flag = reader.ReadByte();

            reader.Position--;

            switch ((CallingConventionAttributes)flag & SignatureTypeMask)
            {
            case CallingConventionAttributes.Default:
            case CallingConventionAttributes.C:
            case CallingConventionAttributes.ExplicitThis:
            case CallingConventionAttributes.FastCall:
            case CallingConventionAttributes.StdCall:
            case CallingConventionAttributes.ThisCall:
            case CallingConventionAttributes.VarArg:
                return(MethodSignature.FromReader(image, reader));

            case CallingConventionAttributes.Property:
                return(PropertySignature.FromReader(image, reader));

            case CallingConventionAttributes.Local:
                return(LocalVariableSignature.FromReader(image, reader));

            case CallingConventionAttributes.GenericInstance:
                return(GenericInstanceMethodSignature.FromReader(image, reader));

            case CallingConventionAttributes.Field:
                return(FieldSignature.FromReader(image, reader));
            }
            throw new NotSupportedException();
        }
Exemplo n.º 2
0
        public MemberReference ImportField(FieldInfo field)
        {
            var signature = new FieldSignature(ImportTypeSignature(field.FieldType));
            if (!field.IsStatic)
                signature.Attributes |= CallingConventionAttributes.HasThis;

            var declaringType = ImportType(field.DeclaringType);

            return ImportMember(new MemberReference(declaringType, field.Name, signature));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Determines whether two field signatures are considered equal according to their signatures.
        /// </summary>
        /// <param name="signature1">The first signature to compare.</param>
        /// <param name="signature2">The second signature to compare.</param>
        /// <returns><c>True</c> if the signatures are considered equal, <c>False</c> otherwise.</returns>
        public bool MatchFieldSignatures(FieldSignature signature1, FieldSignature signature2)
        {
            if (signature1 == null && signature2 == null)
                return true;
            if (signature1 == null || signature2 == null)
                return false;

            return signature1.Attributes == signature2.Attributes
                && MatchTypes(signature1.FieldType, signature2.FieldType);
        }
Exemplo n.º 4
0
 public FieldSignature ImportFieldSignature(FieldSignature signature)
 {
     return new FieldSignature(ImportTypeSignature(signature.FieldType))
     {
         Attributes = signature.Attributes
     };
 }