Finish DU parsing (#151)

This commit is contained in:
Patrick Stevens
2024-05-30 22:27:15 +01:00
committed by GitHub
parent 81b7e5361d
commit b98080690d
5 changed files with 310 additions and 48 deletions

View File

@@ -9,6 +9,15 @@ type internal UnionCase<'Ident> =
Ident : Ident
}
[<RequireQualifiedAccess>]
module internal UnionCase =
let mapIdentFields<'a, 'b> (f : 'a -> 'b) (unionCase : UnionCase<'a>) : UnionCase<'b> =
{
Fields = unionCase.Fields |> List.map (SynField.mapIdent f)
Attrs = unionCase.Attrs
Ident = unionCase.Ident
}
[<RequireQualifiedAccess>]
module internal SynUnionCase =
let extract (SynUnionCase (attrs, id, caseType, _, _, _, _)) : UnionCase<Ident option> =