d6bdd08002
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...)
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];
|
|
}
|
|
} |