Add initial pass at constants and operands that reference labels

This commit is contained in:
Yoshi Askharoun
2024-02-11 11:51:59 -06:00
parent a0d5661a99
commit 03f8974ac1
7 changed files with 70 additions and 33 deletions
+38
View File
@@ -0,0 +1,38 @@
namespace Microsoft.Iris.Asm.Models;
public enum LiteralDataType : byte
{
Byte,
UInt16,
UInt32,
Int32,
Bytes,
}
public abstract record Operand(object Value, string Content = null) : AsmItem
{
public override string ToString() => Content ?? Value.ToString();
}
public record OperandLiteral : Operand
{
public OperandLiteral(object value, LiteralDataType dataType, string content = null) : base(value, content)
{
DataType = dataType;
}
public LiteralDataType DataType { get; init; }
public override string ToString() => base.ToString();
}
public record OperandReference : Operand
{
public OperandReference(string labelName) : base(labelName, labelName)
{
}
public string LabelName => Content;
public override string ToString() => base.ToString();
}