mirror of
https://github.com/Smaug123/WoofWare.Myriad
synced 2025-10-06 04:28:42 +00:00
Some fixes to nullability (#365)
This commit is contained in:
@@ -78,6 +78,7 @@ module internal JsonParseGenerator =
|
||||
/// collectionType is e.g. "List"; we'll be calling `ofSeq` on it.
|
||||
/// body is the body of a lambda which takes a parameter `elt`.
|
||||
/// {assertNotNull node}.AsArray()
|
||||
/// |> Seq.cast<JsonNode>
|
||||
/// |> Seq.map (fun elt -> {body})
|
||||
/// |> {collectionType}.ofSeq
|
||||
let asArrayMapped
|
||||
@@ -91,6 +92,13 @@ module internal JsonParseGenerator =
|
||||
| None -> node
|
||||
| Some propertyName -> assertNotNull propertyName node
|
||||
|> SynExpr.callMethod "AsArray"
|
||||
|> SynExpr.pipeThroughFunction (
|
||||
SynExpr.createLongIdent [ "Seq" ; "cast" ]
|
||||
|> SynExpr.typeApp
|
||||
[
|
||||
SynType.createLongIdent' [ "System" ; "Text" ; "Json" ; "Nodes" ; "JsonNode" ]
|
||||
]
|
||||
)
|
||||
|> SynExpr.pipeThroughFunction (
|
||||
SynExpr.applyFunction (SynExpr.createLongIdent [ "Seq" ; "map" ]) (SynExpr.createLambda "elt" body)
|
||||
)
|
||||
@@ -273,10 +281,12 @@ module internal JsonParseGenerator =
|
||||
)
|
||||
|> SynExpr.pipeThroughFunction (SynExpr.createLongIdent [ "Map" ; "ofSeq" ])
|
||||
| BigInt ->
|
||||
node
|
||||
AstHelper.raiseIfNull (Ident.create "v")
|
||||
|> SynExpr.paren
|
||||
|> SynExpr.callMethod "ToJsonString"
|
||||
|> SynExpr.paren
|
||||
|> SynExpr.applyFunction (SynExpr.createLongIdent [ "System" ; "Numerics" ; "BigInteger" ; "Parse" ])
|
||||
|> SynExpr.createLet [ SynBinding.basic [ Ident.create "v" ] [] node ]
|
||||
| Measure (_measure, primType) ->
|
||||
parseNumberType options propertyName node primType
|
||||
|> SynExpr.pipeThroughFunction (Measure.getLanguagePrimitivesMeasure primType)
|
||||
|
Reference in New Issue
Block a user