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...)
25 lines
493 B
C#
25 lines
493 B
C#
namespace meowlang.typechecker;
|
|
|
|
public class TypeRegistry
|
|
{
|
|
private readonly Dictionary<Guid, TypeDescription> _types = new ();
|
|
|
|
public Dictionary<Guid, TypeDescription> DebugGetTypes => _types;
|
|
|
|
public void Add(Guid guid, TypeDescription description)
|
|
{
|
|
_types[guid] = description;
|
|
}
|
|
|
|
public TypeDescription Get(Guid guid)
|
|
{
|
|
return _types[guid];
|
|
}
|
|
|
|
public bool Has(Guid guid)
|
|
{
|
|
return _types.ContainsKey(guid);
|
|
}
|
|
|
|
|
|
} |