Files
MicrosoftIris/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs
T

50 lines
1.2 KiB
C#
Raw Normal View History

using Microsoft.Iris.Markup;
using System;
2022-06-07 14:30:29 -05:00
using System.Collections.Generic;
2023-05-24 16:24:48 -05:00
using System.Text;
2022-06-07 01:00:15 -05:00
2023-05-22 18:04:22 -05:00
namespace Microsoft.Iris.Debug.Data;
[Serializable]
2023-05-22 18:04:22 -05:00
public class InterpreterEntry
2022-06-07 01:00:15 -05:00
{
public InterpreterEntry(OpCode opCode, uint offset, string loadUri, params InterpreterObject[] args)
2022-06-07 01:00:15 -05:00
{
2023-05-22 18:04:22 -05:00
OpCode = opCode;
2023-05-24 16:24:48 -05:00
Offset = offset;
LoadUri = loadUri;
2022-06-07 14:30:29 -05:00
2023-05-22 18:04:22 -05:00
if (args != null && args.Length > 0)
Parameters = args;
else
Parameters = new List<InterpreterObject>();
2022-06-07 01:00:15 -05:00
}
public OpCode OpCode { get; }
2023-05-24 16:24:48 -05:00
public uint Offset { get; }
public string LoadUri { get; }
public IList<InterpreterObject> Parameters { get; }
2023-05-24 16:24:48 -05:00
public IList<InterpreterObject> ReturnValues { get; } = new List<InterpreterObject>();
2023-05-22 18:04:22 -05:00
public override string ToString()
2022-06-07 01:00:15 -05:00
{
StringBuilder sb = new($"[{LoadUri} @ 0x{Offset:X}] {OpCode}({string.Join(", ", Parameters)})");
2023-05-24 16:24:48 -05:00
if (ReturnValues.Count > 0)
{
sb.Append(" -> ");
if (ReturnValues.Count == 1)
sb.Append(ReturnValues[0]);
else
sb.Append($"[{string.Join(", ", ReturnValues)}]");
}
return sb.ToString();
2022-06-07 01:00:15 -05:00
}
}