| | | 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 | | |
| | | 4 | | using System.Collections.Immutable; |
| | | 5 | | using System.Reflection.Metadata; |
| | | 6 | | |
| | | 7 | | namespace System.Reflection.Metadata |
| | | 8 | | { |
| | | 9 | | /// <summary> |
| | | 10 | | /// Represents a method (definition, reference, or standalone) or property signature. |
| | | 11 | | /// In the case of properties, the signature matches that of a getter with a distinguishing <see cref="SignatureHead |
| | | 12 | | /// </summary> |
| | | 13 | | public readonly struct MethodSignature<TType> |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Represents the information in the leading byte of the signature (kind, calling convention, flags). |
| | | 17 | | /// </summary> |
| | 0 | 18 | | public SignatureHeader Header { get; } |
| | | 19 | | |
| | | 20 | | /// <summary> |
| | | 21 | | /// Gets the method's return type. |
| | | 22 | | /// </summary> |
| | 0 | 23 | | public TType ReturnType { get; } |
| | | 24 | | |
| | | 25 | | /// <summary> |
| | | 26 | | /// Gets the number of parameters that are required. Will be equal to the length <see cref="ParameterTypes"/> of |
| | | 27 | | /// unless this signature represents the standalone call site of a vararg method, in which case the entries |
| | | 28 | | /// extra entries in <see cref="ParameterTypes"/> are the types used for the optional parameters. |
| | | 29 | | /// </summary> |
| | 0 | 30 | | public int RequiredParameterCount { get; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets the number of generic type parameters of the method. Will be 0 for non-generic methods. |
| | | 34 | | /// </summary> |
| | 0 | 35 | | public int GenericParameterCount { get; } |
| | | 36 | | |
| | | 37 | | /// <summary> |
| | | 38 | | /// Gets the method's parameter types. |
| | | 39 | | /// </summary> |
| | 0 | 40 | | public ImmutableArray<TType> ParameterTypes { get; } |
| | | 41 | | |
| | | 42 | | public MethodSignature(SignatureHeader header, TType returnType, int requiredParameterCount, int genericParamete |
| | 0 | 43 | | { |
| | 0 | 44 | | Header = header; |
| | 0 | 45 | | ReturnType = returnType; |
| | 0 | 46 | | GenericParameterCount = genericParameterCount; |
| | 0 | 47 | | RequiredParameterCount = requiredParameterCount; |
| | 0 | 48 | | ParameterTypes = parameterTypes; |
| | 0 | 49 | | } |
| | | 50 | | } |
| | | 51 | | } |
| | | 52 | | |