meowlang/parser/SwitchExpressionModel.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

19 lines
554 B
C#

namespace meowlang.parser;
public record SwitchExpressionModel(Span Span, ExpressionModel Expression,
List<(LiteralModel Value, ExpressionModel? Body)> Cases, ExpressionModel? Default) : ExpressionModel(Span)
{
public override IEnumerable<ModelBase> GetChildren()
{
foreach (var modelBase in base.GetChildren())
{
yield return modelBase;
}
foreach (var (condition, block) in Cases)
{
yield return condition;
if (block != null) yield return block;
}
}
}