add some very basic foundation for static typing
This commit is contained in:
parent
c4de1dfb0a
commit
880f3e60ce
|
|
@ -1,6 +1,6 @@
|
|||
namespace Qrakhen.Qamp.Core.Values.Objects;
|
||||
|
||||
public class Obj(ValueType type) : IValue
|
||||
public class Obj(ValueType type) : IDynamicValue
|
||||
{
|
||||
public bool __gcMarked = false;
|
||||
public int __gcCount = 1;
|
||||
|
|
|
|||
|
|
@ -7,13 +7,21 @@ using T = Qrakhen.Qamp.Core.Values.ValueType;
|
|||
|
||||
namespace Qrakhen.Qamp.Core.Values;
|
||||
|
||||
public interface IValue
|
||||
public interface IValue<T>
|
||||
{
|
||||
T Data { get; }
|
||||
}
|
||||
|
||||
public interface IDynamicValue : IValue<ulong>
|
||||
{
|
||||
T ValueType { get; }
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 0x10)]
|
||||
public readonly struct Value : IValue, ISerialize<Value>, IDebug<string>
|
||||
public readonly struct Value :
|
||||
IDynamicValue,
|
||||
ISerialize<Value>,
|
||||
IDebug<string>
|
||||
{
|
||||
public static readonly Value Void = new Value();
|
||||
public static readonly Value True = new Value(true);
|
||||
|
|
@ -28,6 +36,8 @@ public readonly struct Value : IValue, ISerialize<Value>, IDebug<string>
|
|||
[FieldOffset(0x00)] [Serialized] public readonly Ptr Ptr;
|
||||
[FieldOffset(0x00)] [Serialized] public readonly Ref Ref;
|
||||
|
||||
public ulong Data => Unsigned;
|
||||
|
||||
[FieldOffset(0x08)] [Serialized] public readonly T Type;
|
||||
|
||||
[FieldOffset(0x0c)] [Serialized] public readonly uint Meta; // like lengths of arrays or lists
|
||||
|
|
|
|||
Loading…
Reference in New Issue