-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an ability to inspect stack machine chains
- Loading branch information
1 parent
0e4df5c
commit af5d7b9
Showing
5 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/Kinetic/Linq/StateMachines/StateMachineBoxDebugView.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
|
||
namespace Kinetic.Linq.StateMachines; | ||
|
||
internal sealed class StateMachineBoxDebugView<T, TStateMachine> | ||
where TStateMachine : struct, IStateMachine<T> | ||
{ | ||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] | ||
public IReadOnlyList<StateMachine> Items { get; } | ||
|
||
public StateMachineBoxDebugView(StateMachineBox<T, TStateMachine> box) | ||
{ | ||
var items = new List<StateMachine>(); | ||
var reference = box.StateMachine.Reference as StateMachine; | ||
while (reference is { }) | ||
{ | ||
items.Add(reference); | ||
reference = reference.Continuation; | ||
} | ||
|
||
Items = items.ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System.Diagnostics; | ||
|
||
namespace Kinetic.Linq.StateMachines; | ||
|
||
internal sealed class StateMachineDebugView<T, TStateMachine> | ||
where TStateMachine : struct, IStateMachine<T> | ||
{ | ||
private readonly StateMachine<T, TStateMachine> _stateMachine; | ||
|
||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] | ||
public TStateMachine StateMachine => | ||
_stateMachine.Reference.Target; | ||
|
||
public StateMachineDebugView(StateMachine<T, TStateMachine> stateMachine) => | ||
_stateMachine = stateMachine; | ||
} |