2022-06-07 01:00:15 -05:00
|
|
|
using System;
|
2022-06-07 14:30:29 -05:00
|
|
|
using System.Collections.Generic;
|
2022-06-07 01:00:15 -05:00
|
|
|
|
2023-05-22 18:04:22 -05:00
|
|
|
namespace Microsoft.Iris.Debug.Data;
|
|
|
|
|
|
|
|
|
|
public class InterpreterEntry
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-22 18:04:22 -05:00
|
|
|
public InterpreterEntry(object opCode, params OpCodeArgument[] args)
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-22 18:04:22 -05:00
|
|
|
OpCode = opCode;
|
2022-06-07 14:30:29 -05:00
|
|
|
|
2023-05-22 18:04:22 -05:00
|
|
|
if (args != null && args.Length > 0)
|
|
|
|
|
Arguments = args;
|
|
|
|
|
else
|
|
|
|
|
Arguments = new List<OpCodeArgument>();
|
2022-06-07 01:00:15 -05:00
|
|
|
}
|
|
|
|
|
|
2023-05-22 18:04:22 -05:00
|
|
|
public object OpCode { get; }
|
|
|
|
|
public IList<OpCodeArgument> Arguments { get; }
|
|
|
|
|
public IList<object> ReturnValues { get; } = new List<object>();
|
|
|
|
|
|
|
|
|
|
public override string ToString()
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-22 18:04:22 -05:00
|
|
|
return $"{OpCode}({string.Join(", ", Arguments)}) -> [{ReturnValues}]";
|
2022-06-07 01:00:15 -05:00
|
|
|
}
|
|
|
|
|
}
|
2023-05-22 18:04:22 -05:00
|
|
|
|
|
|
|
|
public class OpCodeArgument
|
|
|
|
|
{
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
public Type Type { get; set; }
|
|
|
|
|
public object Value { get; set; }
|
|
|
|
|
|
|
|
|
|
public OpCodeArgument(string name, Type type, object value)
|
|
|
|
|
{
|
|
|
|
|
Name = name;
|
|
|
|
|
Type = type;
|
|
|
|
|
Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString() => $"{Type} {Value}";
|
|
|
|
|
}
|