24 lines
528 B
C#
24 lines
528 B
C#
|
namespace meowlang.typechecker;
|
||
|
|
||
|
public record TupleTypeDescription : TypeDescription
|
||
|
{
|
||
|
private readonly List<TypeId> _members;
|
||
|
|
||
|
public List<TypeId> DebugGetMembers => _members;
|
||
|
|
||
|
public TupleTypeDescription(List<TypeId> members)
|
||
|
{
|
||
|
_members = members;
|
||
|
}
|
||
|
|
||
|
public int Length => _members.Count;
|
||
|
|
||
|
public TypeId GetTypeForMember(ushort index)
|
||
|
{
|
||
|
if (index > Length)
|
||
|
{
|
||
|
throw new UnknownTupleMemberException(index);
|
||
|
}
|
||
|
return _members[index];
|
||
|
}
|
||
|
}
|