Skip to content

Commit 7612843

Browse files
committed
cleanup
1 parent 81421fe commit 7612843

File tree

14 files changed

+470
-431
lines changed

14 files changed

+470
-431
lines changed

src/Compiler/Driver/GraphChecking/Graph.fs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -75,48 +75,6 @@ module internal Graph =
7575
|> readOnlyDict
7676
|> addIfMissing originalGraph.Keys
7777

78-
/// Returns leaves of the graph and the remaining graph without the leaves.
79-
let cutLeaves (graph: Graph<'Node>) =
80-
let notLeaves =
81-
set
82-
[
83-
for (KeyValue (node, deps)) in graph do
84-
if deps.Length > 0 then
85-
node
86-
]
87-
88-
let leaves =
89-
set
90-
[
91-
for (KeyValue (node, deps)) in graph do
92-
if deps.Length = 0 then
93-
node
94-
95-
yield! deps |> Array.filter (notLeaves.Contains >> not)
96-
]
97-
98-
leaves,
99-
seq {
100-
for (KeyValue (node, deps)) in graph do
101-
if deps.Length > 0 then
102-
node, deps |> Array.filter (leaves.Contains >> not)
103-
}
104-
|> make
105-
106-
/// Returns layers of leaves repeatedly removed from the graph until there's nothing left
107-
let leafSequence (graph: Graph<'Node>) =
108-
let rec loop (graph: Graph<'Node>) acc =
109-
match graph |> cutLeaves with
110-
| leaves, _ when leaves.IsEmpty -> acc
111-
| leaves, graph ->
112-
seq {
113-
yield! acc
114-
leaves
115-
}
116-
|> loop graph
117-
118-
loop graph Seq.empty
119-
12078
let printCustom (graph: Graph<'Node>) (nodePrinter: 'Node -> string) : unit =
12179
printfn "Graph:"
12280
let join (xs: string[]) = System.String.Join(", ", xs)

src/Compiler/Driver/GraphChecking/Graph.fsi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ module internal Graph =
1919
val subGraphFor: node: 'Node -> graph: Graph<'Node> -> Graph<'Node> when 'Node: equality
2020
/// Create a reverse of the graph.
2121
val reverse<'Node when 'Node: equality> : originalGraph: Graph<'Node> -> Graph<'Node>
22-
/// Returns layers of leaves repeatedly removed from the graph until there's nothing left
23-
val leafSequence: graph: Graph<'Node> -> Set<'Node> seq
2422
/// Print the contents of the graph to the standard output.
2523
val print: graph: Graph<'Node> -> unit
2624
/// Create a simple Mermaid graph

src/Compiler/Driver/GraphChecking/GraphProcessing.fs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,13 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison>
232232

233233
let raiseExn (item, ex: exn) =
234234
localCts.Cancel()
235-
match ex with
236-
| :? OperationCanceledException ->
237-
completionSignal.TrySetCanceled()
238-
| _ ->
239-
completionSignal.TrySetException(GraphProcessingException($"[*] Encountered exception when processing item '{item}': {ex.Message}", ex))
235+
236+
match ex with
237+
| :? OperationCanceledException -> completionSignal.TrySetCanceled()
238+
| _ ->
239+
completionSignal.TrySetException(
240+
GraphProcessingException($"[*] Encountered exception when processing item '{item}': {ex.Message}", ex)
241+
)
240242
|> ignore
241243

242244
let incrementProcessedNodesCount () =
@@ -280,8 +282,8 @@ let processGraphAsync<'Item, 'Result when 'Item: equality and 'Item: comparison>
280282
leaves |> Array.iter queueNode
281283

282284
// Wait for end of processing, an exception, or an external cancellation request.
283-
do! completionSignal.Task |> Async.AwaitTask
284-
285+
do! completionSignal.Task |> Async.AwaitTask
286+
285287
// All calculations succeeded - extract the results and sort in input order.
286288
return
287289
nodes.Values

0 commit comments

Comments
 (0)