47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
|
////////////////////////////////////////////////////////////
|
||
|
// THIS FILE IS GENERATED. //
|
||
|
// DO NOT EDIT. //
|
||
|
////////////////////////////////////////////////////////////
|
||
|
|
||
|
#nullable enable
|
||
|
|
||
|
namespace Finn.AST;
|
||
|
|
||
|
public abstract record Pattern() {
|
||
|
public abstract T accept<T>(IPatternVisitor<T> visitor);
|
||
|
}
|
||
|
public interface IPatternVisitor<T> {
|
||
|
T visitIdentifierPatternPattern(IdentifierPattern pattern);
|
||
|
T visitVariantPatternPattern(VariantPattern pattern);
|
||
|
T visitFieldPatternPattern(FieldPattern pattern);
|
||
|
T visitRecordPatternPattern(RecordPattern pattern);
|
||
|
}
|
||
|
public partial record IdentifierPattern(Name? Identifier) : Pattern()
|
||
|
{
|
||
|
public override T accept<T>(IPatternVisitor<T> visitor)
|
||
|
{
|
||
|
return visitor.visitIdentifierPatternPattern(this);
|
||
|
}
|
||
|
}
|
||
|
public partial record VariantPattern(Name Tag, Pattern? Argument) : Pattern()
|
||
|
{
|
||
|
public override T accept<T>(IPatternVisitor<T> visitor)
|
||
|
{
|
||
|
return visitor.visitVariantPatternPattern(this);
|
||
|
}
|
||
|
}
|
||
|
public partial record FieldPattern(Name Name, Pattern? Pattern) : Pattern()
|
||
|
{
|
||
|
public override T accept<T>(IPatternVisitor<T> visitor)
|
||
|
{
|
||
|
return visitor.visitFieldPatternPattern(this);
|
||
|
}
|
||
|
}
|
||
|
public partial record RecordPattern(FieldPattern[] Fields, IdentifierPattern Rest) : Pattern()
|
||
|
{
|
||
|
public override T accept<T>(IPatternVisitor<T> visitor)
|
||
|
{
|
||
|
return visitor.visitRecordPatternPattern(this);
|
||
|
}
|
||
|
}
|