Esempio n. 1
0
 public DmdMethodRefMD(DmdEcma335MetadataReader reader, uint signature, IList <DmdType> genericTypeArguments, DmdType declaringTypeRef, string name, DmdMethodSignature rawMethodSignature, DmdMethodSignature methodSignature)
     : base(declaringTypeRef, name, rawMethodSignature, methodSignature)
 {
     this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
     this.genericTypeArguments = genericTypeArguments;
     this.signature            = signature;
 }
Esempio n. 2
0
 public DmdMethodDefMD(DmdEcma335MetadataReader reader, RawMethodRow row, uint rid, string name, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
 {
     this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
     MethodImplementationFlags = (DmdMethodImplAttributes)row.ImplFlags;
     Attributes      = (DmdMethodAttributes)row.Flags;
     Name            = name ?? throw new ArgumentNullException(nameof(name));
     methodSignature = reader.ReadMethodSignature(row.Signature, DeclaringType.GetGenericArguments(), GetGenericArguments(), isProperty: false);
 }
Esempio n. 3
0
        public DmdPropertyDefMD(DmdEcma335MetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            var row = reader.TablesStream.ReadPropertyRow(rid);

            Name            = reader.StringsStream.ReadNoNull(row.Name);
            Attributes      = (DmdPropertyAttributes)row.PropFlags;
            methodSignature = reader.ReadMethodSignature(row.Type, DeclaringType.GetGenericArguments(), null, isProperty: true);
        }
Esempio n. 4
0
        public DmdFieldDefMD(DmdEcma335MetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            var row = reader.TablesStream.ReadFieldRow(rid);

            Attributes = (DmdFieldAttributes)row.Flags;
            Name       = reader.StringsStream.ReadNoNull(row.Name);
            FieldType  = reader.ReadFieldType(row.Signature, DeclaringType.GetGenericArguments());
        }
Esempio n. 5
0
        public DmdTypeDefMD(DmdEcma335MetadataReader reader, uint rid, IList <DmdCustomModifier> customModifiers) : base(rid, customModifiers)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            var    row = reader.TablesStream.ReadTypeDefRow(rid);
            string ns  = reader.StringsStream.Read(row.Namespace);

            MetadataNamespace = string.IsNullOrEmpty(ns) ? null : ns;
            MetadataName      = reader.StringsStream.ReadNoNull(row.Name);
            Attributes        = FixAttributes((DmdTypeAttributes)row.Flags);
        }
Esempio n. 6
0
        public DmdEventDefMD(DmdEcma335MetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            var row = reader.TablesStream.ReadEventRow(rid);

            Name       = reader.StringsStream.ReadNoNull(row.Name);
            Attributes = (DmdEventAttributes)row.EventFlags;
            if (!CodedToken.TypeDefOrRef.Decode(row.EventType, out uint token))
            {
                token = uint.MaxValue;
            }
            EventHandlerType = reader.ResolveType((int)token, DeclaringType.GetGenericArguments(), null, DmdResolveOptions.None) ?? reader.Module.AppDomain.System_Void;
        }
Esempio n. 7
0
        public DmdFieldDefMD(DmdEcma335MetadataReader reader, uint rid, DmdType declaringType, DmdType reflectedType) : base(rid, declaringType, reflectedType)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
            bool b = reader.TablesStream.TryReadFieldRow(rid, out var row);

            Debug.Assert(b);
            Attributes = (DmdFieldAttributes)row.Flags;
            Name       = reader.StringsStream.ReadNoNull(row.Name);
            FieldType  = reader.ReadFieldType(row.Signature, DeclaringType.GetGenericArguments());
            if (HasFieldRVA)
            {
                reader.TablesStream.TryReadFieldRVARow(reader.Metadata.GetFieldRVARid(rid), out var rvaRow);
                FieldRVA = rvaRow.RVA;
            }
        }
Esempio n. 8
0
        public DmdTypeRefMD(DmdEcma335MetadataReader reader, uint rid, IList <DmdCustomModifier> customModifiers) : base(reader.Module, rid, customModifiers)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));

            bool b = reader.TablesStream.TryReadTypeRefRow(rid, out var row);

            Debug.Assert(b);
            var ns = reader.StringsStream.Read(row.Namespace);

            MetadataNamespace = string.IsNullOrEmpty(ns) ? null : ns;
            MetadataName      = reader.StringsStream.ReadNoNull(row.Name);

            if (!CodedToken.ResolutionScope.Decode(row.ResolutionScope, out uint resScopeToken))
            {
                resScopeToken = uint.MaxValue;
            }
            switch (resScopeToken >> 24)
            {
            case 0x00:
                TypeScope = new DmdTypeScope(reader.Module);
                break;

            case 0x01:
                TypeScope     = DmdTypeScope.Invalid;
                declTypeToken = (int)resScopeToken;
                break;

            case 0x1A:
                reader.TablesStream.TryReadModuleRefRow(resScopeToken & 0x00FFFFFF, out var moduleRefRow);
                var moduleName = reader.StringsStream.ReadNoNull(moduleRefRow.Name);
                TypeScope = new DmdTypeScope(reader.GetName(), moduleName);
                break;

            case 0x23:
                TypeScope = new DmdTypeScope(reader.ReadAssemblyName(resScopeToken & 0x00FFFFFF));
                break;

            default:
                TypeScope = DmdTypeScope.Invalid;
                break;
            }
        }
Esempio n. 9
0
        public DmdExportedTypeMD(DmdEcma335MetadataReader reader, uint rid, IList <DmdCustomModifier> customModifiers) : base(reader.Module, rid, customModifiers)
        {
            this.reader = reader ?? throw new ArgumentNullException(nameof(reader));

            bool b = reader.TablesStream.TryReadExportedTypeRow(rid, out var row);

            Debug.Assert(b);
            var ns = reader.StringsStream.Read(row.TypeNamespace);

            MetadataNamespace = string.IsNullOrEmpty(ns) ? null : ns;
            MetadataName      = reader.StringsStream.ReadNoNull(row.TypeName);

            if (!CodedToken.Implementation.Decode(row.Implementation, out uint implToken))
            {
                implToken = uint.MaxValue;
            }
            switch (implToken >> 24)
            {
            case 0x23:
                TypeScope = new DmdTypeScope(reader.ReadAssemblyName(implToken & 0x00FFFFFF));
                break;

            case 0x26:
                reader.TablesStream.TryReadFileRow(implToken & 0x00FFFFFF, out var fileRow);
                var moduleName = reader.StringsStream.ReadNoNull(fileRow.Name);
                TypeScope = new DmdTypeScope(reader.GetName(), moduleName);
                break;

            case 0x27:
                TypeScope     = DmdTypeScope.Invalid;
                baseTypeToken = (int)implToken;
                break;

            default:
                TypeScope = DmdTypeScope.Invalid;
                break;
            }
        }
 public DmdGenericParameterTypeMD(DmdEcma335MetadataReader reader, uint rid, DmdTypeBase declaringType, string name, int position, DmdGenericParameterAttributes attributes, IList <DmdCustomModifier> customModifiers)
     : base(rid, declaringType, name, position, attributes, customModifiers) =>
     this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
Esempio n. 11
0
 public DmdParameterDefMD(DmdEcma335MetadataReader reader, uint rid, string name, DmdParameterAttributes attributes, DmdMemberInfo member, int position, DmdType parameterType) : base(rid, member, position, parameterType)
 {
     this.reader = reader ?? throw new ArgumentNullException(nameof(reader));
     Name        = name;     // Null is allowed
     Attributes  = attributes;
 }