/// <summary>
        /// Creates a member reference from an implementation map metadata row.
        /// </summary>
        /// <param name="parentModule">The module that contains the mapping.</param>
        /// <param name="token">The token to initialize the mapping for.</param>
        /// <param name="row">The metadata table row to base the mapping on.</param>
        public SerializedImplementationMap(SerializedModuleDefinition parentModule,
                                           MetadataToken token, ImplementationMapRow row)
            : base(token)
        {
            _parentModule = parentModule ?? throw new ArgumentNullException(nameof(parentModule));
            _row          = row;

            Attributes = _row.Attributes;
        }
Exemple #2
0
        private void AddImplementationMap(MetadataToken ownerToken, ImplementationMap implementationMap)
        {
            if (implementationMap is null)
            {
                return;
            }

            var table   = Metadata.TablesStream.GetSortedTable <ImplementationMap, ImplementationMapRow>(TableIndex.ImplMap);
            var encoder = Metadata.TablesStream.GetIndexEncoder(CodedIndex.MemberForwarded);

            var row = new ImplementationMapRow(
                implementationMap.Attributes,
                encoder.EncodeToken(ownerToken),
                Metadata.StringsStream.GetStringIndex(implementationMap.Name),
                GetModuleReferenceToken(implementationMap.Scope).Rid);

            table.Add(implementationMap, row);
        }