From b0b9496c4a80e0aea1336e8aac32b1dd4fdaa9bf Mon Sep 17 00:00:00 2001 From: Marc Hernandez Date: Fri, 26 Jul 2024 20:53:36 -0700 Subject: [PATCH] x) Updated argument expressions and method overrides in multiple classes In this commit, several changes were made across different files: - In `FSM.cs` and `Imm.cs`, the `[CallerArgumentExpression]` attribute was updated to reflect the correct argument names. - The `ProcessWork` method in `Imm.cs` was changed from virtual to override. - In `Log.cs`, the `[CallerArgumentExpression]` attribute was updated for clarity. - A new override for the `GetHashCode()` method was added in `AddressStack.cs`. - The version of "Microsoft.CodeAnalysis.CSharp" package reference was updated from 4.2.0 to 4.3.1 in 'SharpLib.csproj'. These changes improve code readability and ensure that methods are correctly overridden where necessary. Also, updating the package version ensures compatibility with newer features or bug fixes provided by Microsoft's C# compiler platform. --- SharpLib.csproj | 2 +- imm/FSM.cs | 2 +- imm/Imm.cs | 4 ++-- logging/Log.cs | 2 +- prof/AddressStack.cs | 4 +++- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/SharpLib.csproj b/SharpLib.csproj index 471b05e..915ccf5 100644 --- a/SharpLib.csproj +++ b/SharpLib.csproj @@ -22,7 +22,7 @@ - + diff --git a/imm/FSM.cs b/imm/FSM.cs index d392630..0afd7d5 100644 --- a/imm/FSM.cs +++ b/imm/FSM.cs @@ -54,7 +54,7 @@ public record class FSM : imm.Recorded, Imm [CallerMemberName] string memberName = "", [CallerFilePath] string filePath = "", [CallerLineNumber] int lineNumber = 0, - [CallerArgumentExpression("fn")] + [CallerArgumentExpression("newState")] string expression = default ) { diff --git a/imm/Imm.cs b/imm/Imm.cs index 5a60dfc..bb75fe8 100644 --- a/imm/Imm.cs +++ b/imm/Imm.cs @@ -340,7 +340,7 @@ public record class Timed : Recorded, imm.Imm [CallerMemberName] string dbgName = "", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = 0, - [CallerArgumentExpression("next")] + [CallerArgumentExpression("fn")] string dbgExp = "" ) where U : T @@ -358,7 +358,7 @@ public record class Timed : Recorded, imm.Imm ) => ProcessWork( fn, reason, dbgName, dbgPath, dbgLine, dbgExp ); - virtual public T ProcessWork( Func fn, + override public T ProcessWork( Func fn, string reason, string dbgName, string dbgPath, diff --git a/logging/Log.cs b/logging/Log.cs index 08ad3ab..0365fa8 100644 --- a/logging/Log.cs +++ b/logging/Log.cs @@ -45,7 +45,7 @@ public record struct Value( T _val, string _exp = "" ) } static public Value Get( U v, - [CallerArgumentExpression("fn")] + [CallerArgumentExpression("v")] string dbgExp = "" ) { diff --git a/prof/AddressStack.cs b/prof/AddressStack.cs index c766c9f..3face11 100644 --- a/prof/AddressStack.cs +++ b/prof/AddressStack.cs @@ -31,7 +31,9 @@ namespace Tracing return true; } - public IReadOnlyList Stack => _stack; + public override int GetHashCode() => _stack.GetHashCode(); + + public IReadOnlyList Stack => _stack; public void AddFrame(ulong address) {