meowlang/typechecker/types/TupleTypeDescription.cs
Gwendolyn d6bdd08002 loooots of stuff
the typechecker project can collect all the top level types from a file, which is pretty cool I think
(except for pointers, those aren't implemented yet...)
2022-02-13 02:41:16 +01:00

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];
}
}