mirror of
https://github.com/Smaug123/WoofWare.Whippet
synced 2025-10-06 08:18:39 +00:00
Some checks failed
.NET / build (Debug) (push) Has been cancelled
.NET / build (Release) (push) Has been cancelled
.NET / analyzers (push) Has been cancelled
.NET / build-nix (push) Has been cancelled
.NET / check-dotnet-format (push) Has been cancelled
.NET / check-nix-format (push) Has been cancelled
.NET / Check links (push) Has been cancelled
.NET / Check flake (push) Has been cancelled
.NET / nuget-pack (push) Has been cancelled
.NET / expected-pack (push) Has been cancelled
.NET / all-required-checks-complete (push) Has been cancelled
29 lines
1.1 KiB
Forth
29 lines
1.1 KiB
Forth
namespace WoofWare.Whippet.Fantomas
|
|
|
|
open Fantomas.FCS.Syntax
|
|
open Fantomas.FCS.Text.Range
|
|
|
|
/// Methods for manipulating SynMatchClause, a type representing a single arm of a `match` pattern match.
|
|
/// For example, the entire line of code `| Foo (a, b) -> bar` is represented by one of these.
|
|
[<RequireQualifiedAccess>]
|
|
module SynMatchClause =
|
|
/// Represents the `match` arm `| {lhs} -> {rhs}`.
|
|
let create (lhs : SynPat) (rhs : SynExpr) : SynMatchClause =
|
|
SynMatchClause.SynMatchClause (
|
|
lhs,
|
|
None,
|
|
rhs,
|
|
range0,
|
|
DebugPointAtTarget.Yes,
|
|
{
|
|
ArrowRange = Some range0
|
|
BarRange = Some range0
|
|
}
|
|
)
|
|
|
|
/// Replace the `where` clause (or add a new one, if there isn't one already) in this `match` arm.
|
|
let withWhere (where : SynExpr) (m : SynMatchClause) : SynMatchClause =
|
|
match m with
|
|
| SynMatchClause (synPat, _, resultExpr, range, debugPointAtTarget, synMatchClauseTrivia) ->
|
|
SynMatchClause (synPat, Some where, resultExpr, range, debugPointAtTarget, synMatchClauseTrivia)
|