Ejemplo n.º 1
0
        /// <inheritdoc />
        public MetadataToken GetTypeSpecificationToken(TypeSpecification type)
        {
            AssertIsImported(type);

            var table = Metadata.TablesStream.GetTable <TypeSpecificationRow>(TableIndex.TypeSpec);
            var row   = new TypeSpecificationRow(Metadata.BlobStream.GetBlobIndex(this, type.Signature));

            var token = table.Add(row);

            AddCustomAttributes(token, type);
            return(token);
        }
        /// <inheritdoc />
        public MetadataToken GetTypeSpecificationToken(TypeSpecification type)
        {
            if (!AssertIsImported(type))
            {
                return(MetadataToken.Zero);
            }

            var table = Metadata.TablesStream.GetTable <TypeSpecificationRow>(TableIndex.TypeSpec);
            var row   = new TypeSpecificationRow(Metadata.BlobStream.GetBlobIndex(this, type.Signature, DiagnosticBag));

            var token = table.Add(row);

            _tokenMapping.Register(type, token);
            AddCustomAttributes(token, type);
            return(token);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a type specification from a type metadata row.
 /// </summary>
 /// <param name="parentModule">The module that references the type.</param>
 /// <param name="token">The token to initialize the type for.</param>
 /// <param name="row">The metadata table row to base the type specification on.</param>
 public SerializedTypeSpecification(SerializedModuleDefinition parentModule, MetadataToken token, TypeSpecificationRow row)
     : base(token)
 {
     _parentModule = parentModule ?? throw new ArgumentNullException(nameof(parentModule));
     _row          = row;
 }