< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 19
Coverable lines: 19
Total lines: 62
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
DecodeSignature(...)100%110%
GetCustomAttributes()100%110%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/TypeSystem/MethodSpecification.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Collections.Immutable;
 5
 6namespace System.Reflection.Metadata
 7{
 8    public readonly struct MethodSpecification
 9    {
 10        private readonly MetadataReader _reader;
 11
 12        // Workaround: JIT doesn't generate good code for nested structures, so use RowId.
 13        private readonly int _rowId;
 14
 15        internal MethodSpecification(MetadataReader reader, MethodSpecificationHandle handle)
 016        {
 017            _reader = reader;
 018            _rowId = handle.RowId;
 019        }
 20
 21        private MethodSpecificationHandle Handle
 22        {
 023            get { return MethodSpecificationHandle.FromRowId(_rowId); }
 24        }
 25
 26        /// <summary>
 27        /// MethodDef or MemberRef handle specifying to which generic method this <see cref="MethodSpecification"/> refe
 28        /// that is which generic method is it an instantiation of.
 29        /// </summary>
 30        public EntityHandle Method
 31        {
 32            get
 033            {
 034                return _reader.MethodSpecTable.GetMethod(Handle);
 035            }
 36        }
 37
 38        /// <summary>
 39        /// Gets a handle to the signature blob.
 40        /// </summary>
 41        public BlobHandle Signature
 42        {
 43            get
 044            {
 045                return _reader.MethodSpecTable.GetInstantiation(Handle);
 046            }
 47        }
 48
 49        public ImmutableArray<TType> DecodeSignature<TType, TGenericContext>(ISignatureTypeProvider<TType, TGenericConte
 050        {
 051            var decoder = new Ecma335.SignatureDecoder<TType, TGenericContext>(provider, _reader, genericContext);
 052            var blobReader = _reader.GetBlobReader(Signature);
 053            return decoder.DecodeMethodSpecificationSignature(ref blobReader);
 054        }
 55
 56        public CustomAttributeHandleCollection GetCustomAttributes()
 057        {
 058            return new CustomAttributeHandleCollection(_reader, Handle);
 059        }
 60    }
 61}
 62