ihate
ihate
CC#
Created by ihate on 5/17/2025 in #help
records m,ake me weant to CRY
io ahjve this . I NEED to make a type of referencetype.constant which i can do but thats WAYY Too generic becz i want to point to constanttype.stringa nd not just constanttype
public abstract record ReferenceType<T>
{
public required nuint Index { get; set; }

public enum ReferenceKind
{
REGISTER,
CONSTANT,
GLOBAL,
FIELD,
ENUM,
TYPE,
}

public record Register : ReferenceType<uint>;
public record Constant : ReferenceType<ConstantType>;
public record Global : ReferenceType<ValueType>;
public record Field : ReferenceType<FieldType>;
public record Enum : ReferenceType<EnumType>;
public record Type : ReferenceType<ValueType>;
}
public abstract record ReferenceType<T>
{
public required nuint Index { get; set; }

public enum ReferenceKind
{
REGISTER,
CONSTANT,
GLOBAL,
FIELD,
ENUM,
TYPE,
}

public record Register : ReferenceType<uint>;
public record Constant : ReferenceType<ConstantType>;
public record Global : ReferenceType<ValueType>;
public record Field : ReferenceType<FieldType>;
public record Enum : ReferenceType<EnumType>;
public record Type : ReferenceType<ValueType>;
}
public abstract record ConstantType
{
public enum ConstantKind
{
INTEGER,
FLOAT,
BYTES,
STRING,
TYPE,
}

public record Integer(int Value) : ConstantType;
public record Float(double Value) : ConstantType;
public record Bytes(byte[] Value) : ConstantType;
public record String(string Value) : ConstantType;
public record Type(ValueType Value) : ConstantType;
}
public abstract record ConstantType
{
public enum ConstantKind
{
INTEGER,
FLOAT,
BYTES,
STRING,
TYPE,
}

public record Integer(int Value) : ConstantType;
public record Float(double Value) : ConstantType;
public record Bytes(byte[] Value) : ConstantType;
public record String(string Value) : ConstantType;
public record Type(ValueType Value) : ConstantType;
}
PLS ignore the enums and the referencetype<T> because theyre both just markings for me rn so i can remember they dont do anything :) id have to INHERIT constanttype in that record type which i dont know how ? ?? and also what about the other non class types :(
49 replies