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...)
20 lines
498 B
C#
20 lines
498 B
C#
using meowlang.parser;
|
|
|
|
namespace meowlang.typechecker;
|
|
|
|
public static class ModelExtensions
|
|
{
|
|
private static readonly Guid ExpressionTypeKey = new Guid("6560485F-A4B0-4E24-A03D-D87776BBF9F4");
|
|
|
|
public static void SetType(this ExpressionModel m, TypeId t)
|
|
{
|
|
m.Metadata[ExpressionTypeKey] = t;
|
|
}
|
|
|
|
public static TypeId? GetType(this ExpressionModel m)
|
|
{
|
|
m.Metadata.TryGetValue(ExpressionTypeKey, out var value);
|
|
return value as TypeId;
|
|
}
|
|
|
|
} |