Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ILLink.Shared/ParameterIndex.cs')
-rw-r--r--src/ILLink.Shared/ParameterIndex.cs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/ILLink.Shared/ParameterIndex.cs b/src/ILLink.Shared/ParameterIndex.cs
index 84113a820..7a6ea6808 100644
--- a/src/ILLink.Shared/ParameterIndex.cs
+++ b/src/ILLink.Shared/ParameterIndex.cs
@@ -3,12 +3,14 @@
using System.Diagnostics.CodeAnalysis;
+#nullable enable
+
namespace ILLink.Shared.TypeSystemProxy
{
/// <summary>
/// Used to indicate the index of the parameter in the Parameters metadata section (i.e. the first parameter that is not the implicit 'this' is 0)
/// It is very error prone to use an int to represent the index in parameters metadata section / source code parameter index as well as for indexing into argument lists.
- /// Instead, use this struct whenever representing an index of a parameter.
+ /// Instead, use this struct whenever representing an index of a parameter.
/// </summary>
/// <example>
/// In a call to a non-static function Foo(int a, int b, int c)
@@ -25,7 +27,7 @@ namespace ILLink.Shared.TypeSystemProxy
/// 1 refers to b,
/// 2 refers to c.
/// </example>
- public struct ParameterIndex
+ public readonly struct ParameterIndex : System.IEquatable<ParameterIndex>
{
public readonly int Index;
@@ -39,7 +41,10 @@ namespace ILLink.Shared.TypeSystemProxy
public static ParameterIndex operator ++ (ParameterIndex val) => new ParameterIndex (val.Index + 1);
public override bool Equals ([NotNullWhen (true)] object? obj)
- => obj is ParameterIndex other && this == other;
+ => obj is ParameterIndex other && Index == other.Index;
+
+ public bool Equals (ParameterIndex other)
+ => Index == other.Index;
public override int GetHashCode () => Index.GetHashCode ();