diff --git a/src/Unluau/Chunk/Luau/Constant.cs b/src/Unluau/Chunk/Luau/Constant.cs index 4bd4bbf..3c5f9fe 100644 --- a/src/Unluau/Chunk/Luau/Constant.cs +++ b/src/Unluau/Chunk/Luau/Constant.cs @@ -89,38 +89,69 @@ public class Constant(ConstantType type, T value) : Constant(type) public override string? ToString() => Value is null ? "nil" : Value.ToString(); } + /// + /// Represents the `nil` constant in Luau code. + /// public class NilConstant() : Constant(ConstantType.Nil) { public override string ToString() => "nil"; } + /// + /// Represents a boolean value in Luau code. + /// + /// The value of the constant. public class BoolConstant(bool value) : Constant(ConstantType.Bool, value) { public override string ToString() => Value ? "true" : "false"; } + /// + /// Represents a number value constant in Luau code. + /// + /// The value of the constant. public class NumberConstant(double value) : Constant(ConstantType.Number, value) { } + /// + /// Represents a string constant in Luau code. + /// + /// The index of the string in the symbol table. public class StringConstant(int index) : Constant(ConstantType.String, index) { } + /// + /// Represents an import constant in luau code. + /// + /// The list of string constants that make up the import. public class ImportConstant(StringConstant[] names) : Constant(ConstantType.Import, names) { public override string ToString() => $"[{string.Join(",", new List(Value))}]"; } + /// + /// Represents a table constant in luau code. + /// + /// List of constants that make up the keys in the table. public class TableConstant(Constant[] keys) : Constant(ConstantType.Table, keys) { public override string ToString() => $"{{{string.Join(", ", new List(Value))}}}"; } + /// + /// Represents a closure in Luau code (functions). + /// + /// The index of the associated function prototype in the Luau bytecode. public class ClosureConstant(int index) : Constant(ConstantType.Closure, index) { } + /// + /// Represents a vector constant in Luau bytecode. + /// + /// List of floating point numbers. public class VectorConstant(float[] values) : Constant>(ConstantType.Vector, new(values)) { }