@@ -1282,8 +1282,9 @@ module internal TypeFormatter =
1282
1282
n
1283
1283
1284
1284
curriedArgs
1285
- |> List.map ( List.map ( fun x -> formatArgNameAndType ( counter ()) x |> fst))
1286
- |> List.map ( fun argTuple ->
1285
+ |> List.map ( fun args ->
1286
+ let argTuple = args |> List.map ( formatArgNameAndType ( counter ()) >> fst)
1287
+
1287
1288
match argTuple with
1288
1289
| [] -> !! " ()"
1289
1290
| [ argName ] when argName = " ()" -> !! " ()"
@@ -2217,10 +2218,9 @@ module internal SymbolReader =
2217
2218
}
2218
2219
2219
2220
/// Returns whether the link is not included in the document defined links
2220
- let linkNotDefined ( doc : LiterateDocument ) ( link : string ) =
2221
+ let linkDefined ( doc : LiterateDocument ) ( link : string ) =
2221
2222
[ link; link.Replace( " \r\n " , " " ); link.Replace( " \r\n " , " " ); link.Replace( " \n " , " " ); link.Replace( " \n " , " " ) ]
2222
- |> Seq.map ( fun key -> not ( doc.DefinedLinks.ContainsKey( key)))
2223
- |> Seq.reduce ( fun a c -> a && c)
2223
+ |> List.exists ( fun key -> doc.DefinedLinks.ContainsKey( key))
2224
2224
2225
2225
/// Returns a tuple of the undefined link and its Cref if it exists
2226
2226
let getTypeLink ( ctx : ReadingContext ) undefinedLink =
@@ -2264,8 +2264,11 @@ module internal SymbolReader =
2264
2264
do
2265
2265
replacedParagraphs
2266
2266
|> Seq.collect collectParagraphIndirectLinks
2267
- |> Seq.filter ( linkNotDefined doc)
2268
- |> Seq.map ( getTypeLink ctx)
2267
+ |> Seq.choose ( fun line ->
2268
+ if linkDefined doc line then
2269
+ None
2270
+ else
2271
+ getTypeLink ctx line |> Some)
2269
2272
|> Seq.iter ( addLinkToType doc)
2270
2273
2271
2274
doc.With( paragraphs = replacedParagraphs)
@@ -2275,15 +2278,12 @@ module internal SymbolReader =
2275
2278
2276
2279
let text =
2277
2280
lines
2278
- |> List.filter (
2279
- findCommand
2280
- >> ( function
2281
+ |> List.choose ( fun line ->
2282
+ match findCommand line with
2281
2283
| Some( k, v) ->
2282
2284
cmds.[ k] <- v
2283
- false
2284
- | _ -> true )
2285
- )
2286
- |> List.map fst
2285
+ None
2286
+ | _ -> fst line |> Some)
2287
2287
|> String.concat " \n "
2288
2288
2289
2289
let doc =
@@ -2421,8 +2421,7 @@ module internal SymbolReader =
2421
2421
2422
2422
let readChildren ctx ( entities : FSharpEntity seq ) reader cond =
2423
2423
entities
2424
- |> Seq.filter ( fun v -> checkAccess ctx v.Accessibility)
2425
- |> Seq.filter cond
2424
+ |> Seq.filter ( fun v -> checkAccess ctx v.Accessibility && cond v)
2426
2425
|> Seq.sortBy ( fun ( c : FSharpEntity ) -> c.DisplayName)
2427
2426
|> Seq.choose ( reader ctx)
2428
2427
|> List.ofSeq
@@ -2448,23 +2447,28 @@ module internal SymbolReader =
2448
2447
2449
2448
let readAllMembers ctx entityUrl kind ( members : FSharpMemberOrFunctionOrValue seq ) =
2450
2449
members
2451
- |> Seq.filter ( fun v -> checkAccess ctx v.Accessibility)
2452
- |> Seq.filter ( fun v ->
2453
- not v.IsCompilerGenerated
2454
- && not v.IsPropertyGetterMethod
2455
- && not v.IsPropertySetterMethod
2456
- && not v.IsEventAddMethod
2457
- && not v.IsEventRemoveMethod)
2458
- |> Seq.choose ( tryReadMember ctx entityUrl kind)
2450
+ |> Seq.choose ( fun v ->
2451
+ if
2452
+ checkAccess ctx v.Accessibility
2453
+ && not v.IsCompilerGenerated
2454
+ && not v.IsPropertyGetterMethod
2455
+ && not v.IsPropertySetterMethod
2456
+ && not v.IsEventAddMethod
2457
+ && not v.IsEventRemoveMethod
2458
+ then
2459
+ tryReadMember ctx entityUrl kind v
2460
+ else
2461
+ None)
2459
2462
|> List.ofSeq
2460
2463
|> collectNamespaceDocs
2461
2464
2462
2465
let readMembers ctx entityUrl kind ( entity : FSharpEntity ) cond =
2463
2466
entity.MembersFunctionsAndValues
2464
- |> Seq.filter ( fun v -> checkAccess ctx v.Accessibility)
2465
- |> Seq.filter ( fun v -> not v.IsCompilerGenerated)
2466
- |> Seq.filter cond
2467
- |> Seq.choose ( tryReadMember ctx entityUrl kind)
2467
+ |> Seq.choose ( fun v ->
2468
+ if checkAccess ctx v.Accessibility && not v.IsCompilerGenerated && cond v then
2469
+ tryReadMember ctx entityUrl kind v
2470
+ else
2471
+ None)
2468
2472
|> List.ofSeq
2469
2473
|> collectNamespaceDocs
2470
2474
@@ -2485,47 +2489,51 @@ module internal SymbolReader =
2485
2489
let readUnionCases ctx entityUrl ( typ : FSharpEntity ) =
2486
2490
typ.UnionCases
2487
2491
|> List.ofSeq
2488
- |> List.filter ( fun v -> checkAccess ctx v.Accessibility)
2489
2492
|> List.choose ( fun case ->
2490
- readCommentsInto case ctx case.XmlDocSig ( fun cat catidx exclude _ comment ->
2491
- let details = readUnionCase ctx typ case
2492
-
2493
- ApiDocMember(
2494
- case.Name,
2495
- readAttributes case.Attributes,
2496
- entityUrl,
2497
- ApiDocMemberKind.UnionCase,
2498
- cat,
2499
- catidx,
2500
- exclude,
2501
- details,
2502
- comment,
2503
- case,
2504
- ctx.WarnOnMissingDocs
2505
- )))
2493
+ if checkAccess ctx case.Accessibility |> not then
2494
+ None
2495
+ else
2496
+ readCommentsInto case ctx case.XmlDocSig ( fun cat catidx exclude _ comment ->
2497
+ let details = readUnionCase ctx typ case
2498
+
2499
+ ApiDocMember(
2500
+ case.Name,
2501
+ readAttributes case.Attributes,
2502
+ entityUrl,
2503
+ ApiDocMemberKind.UnionCase,
2504
+ cat,
2505
+ catidx,
2506
+ exclude,
2507
+ details,
2508
+ comment,
2509
+ case,
2510
+ ctx.WarnOnMissingDocs
2511
+ )))
2506
2512
|> collectNamespaceDocs
2507
2513
2508
2514
let readRecordFields ctx entityUrl ( typ : FSharpEntity ) =
2509
2515
typ.FSharpFields
2510
2516
|> List.ofSeq
2511
- |> List.filter ( fun field -> not field.IsCompilerGenerated)
2512
2517
|> List.choose ( fun field ->
2513
- readCommentsInto field ctx field.XmlDocSig ( fun cat catidx exclude _ comment ->
2514
- let details = readFSharpField ctx field
2515
-
2516
- ApiDocMember(
2517
- field.Name,
2518
- readAttributes ( Seq.append field.FieldAttributes field.PropertyAttributes),
2519
- entityUrl,
2520
- ApiDocMemberKind.RecordField,
2521
- cat,
2522
- catidx,
2523
- exclude,
2524
- details,
2525
- comment,
2526
- field,
2527
- ctx.WarnOnMissingDocs
2528
- )))
2518
+ if field.IsCompilerGenerated then
2519
+ None
2520
+ else
2521
+ readCommentsInto field ctx field.XmlDocSig ( fun cat catidx exclude _ comment ->
2522
+ let details = readFSharpField ctx field
2523
+
2524
+ ApiDocMember(
2525
+ field.Name,
2526
+ readAttributes ( Seq.append field.FieldAttributes field.PropertyAttributes),
2527
+ entityUrl,
2528
+ ApiDocMemberKind.RecordField,
2529
+ cat,
2530
+ catidx,
2531
+ exclude,
2532
+ details,
2533
+ comment,
2534
+ field,
2535
+ ctx.WarnOnMissingDocs
2536
+ )))
2529
2537
|> collectNamespaceDocs
2530
2538
2531
2539
let readStaticParams ctx entityUrl ( typ : FSharpEntity ) =
@@ -2585,11 +2593,12 @@ module internal SymbolReader =
2585
2593
if isNull nameAttr then
2586
2594
None
2587
2595
else
2588
- Some( nameAttr.Value, p.Value))
2589
- |> Seq.iter ( fun ( name , xmlDoc ) ->
2590
- let xmlDocSig = getFSharpStaticParamXmlSig typ name
2596
+ let xmlDocSig = getFSharpStaticParamXmlSig typ nameAttr.Value
2591
2597
2592
- registerXmlDoc ctx xmlDocSig ( Security.SecurityElement.Escape xmlDoc) |> ignore)
2598
+ registerXmlDoc ctx xmlDocSig ( Security.SecurityElement.Escape p.Value)
2599
+ |> ignore
2600
+ |> Some)
2601
+ |> ignore
2593
2602
2594
2603
let rec readType ( ctx : ReadingContext ) ( typ : FSharpEntity ) =
2595
2604
if typ.IsProvided && typ.XmlDoc <> FSharpXmlDoc.None then
@@ -2617,17 +2626,15 @@ module internal SymbolReader =
2617
2626
2618
2627
let ivals , svals =
2619
2628
getMembers typ
2620
- |> List.ofSeq
2621
- |> List.filter ( fun v ->
2629
+ |> Seq.filter ( fun v ->
2622
2630
checkAccess ctx v.Accessibility
2623
2631
&& not v.IsCompilerGenerated
2624
- && not v.IsOverrideOrExplicitInterfaceImplementation)
2625
- |> List.filter ( fun v ->
2626
- not v.IsCompilerGenerated
2632
+ && not v.IsOverrideOrExplicitInterfaceImplementation
2627
2633
&& not v.IsEventAddMethod
2628
2634
&& not v.IsEventRemoveMethod
2629
2635
&& not v.IsPropertyGetterMethod
2630
2636
&& not v.IsPropertySetterMethod)
2637
+ |> List.ofSeq
2631
2638
|> List.partition ( fun v -> v.IsInstanceMember)
2632
2639
2633
2640
let cvals , svals = svals |> List.partition ( fun v -> v.CompiledName = " .ctor" )
0 commit comments