Commit c8201396 authored by Luke Sandberg's avatar Luke Sandberg

improve documentation and comments to make `vade` happy

parent f35cdd0c
......@@ -146,15 +146,14 @@ pub async fn map_client_references(
// self cycle. They don't introduce new bits anyway.
&& module != *parent_module
{
// copy parent bits down. visit_preorder always visits parents before
// children so we can assert that the parent it set.
// copy parent bits down. `traverse_edges_from_entries_fixed_point`` always visits parents before
// children so we can simply assert that the parent it set.
let [Some(current), Some(parent)] =
parent_modules.get_disjoint_mut([&module, parent_module])
else {
unreachable!()
};
// inherit the server components from the newly observed parent.
// check if we are adding new bits and thus need to revisit children unless we are already planning to because this is a new node.
// Check if we are adding new bits and thus need to revisit children unless we are already planning to because this is a new node.
if !should_visit_children {
let len = current.len();
*current |= &*parent;
......
......@@ -568,19 +568,18 @@ impl SingleModuleGraph {
/// eventual termination of the traversal. This corresponds to computing a fixed point state for
/// the graph.
///
/// Nodes are (re)visited according to the returned priority of the node, prioritizing high
/// values. This priority is intended to be used a heuristic to reduce the number of
/// retraversals.
/// It is guaranteed that the parent node passed to the `visit` function, if any, has
/// already been passed to `visit`.
///
/// * `entries` - The entry modules to start the traversal from
/// * `state` - The state to be passed to the callbacks
/// * `visit` - Called for a specific edge
/// - Receives: (originating &SingleModuleGraphNode, edge &ChunkingType), target
/// - Receives: Option(originating &SingleModuleGraphNode, edge &ChunkingType), target
/// &SingleModuleGraphNode
/// - Return [GraphTraversalAction]s to control the traversal
///
/// Returns the number of node visits (i.e. higher than the node count if there are
/// retraversals).
/// Returns the number of node visits (i.e. higher than the node
/// count if there are retraversals).
pub fn traverse_edges_from_entries_fixed_point<'a>(
&'a self,
entries: impl IntoIterator<Item = ResolvedVc<Box<dyn Module>>>,
......@@ -2001,7 +2000,7 @@ pub mod tests {
}
#[tokio::test]
async fn traverse_edges_from_entries_fixed_point_diamond() {
async fn traverse_edges_from_entries_fixed_point_cycle() {
run_graph_test(
vec![rcstr!("a.js")],
{
......@@ -2040,6 +2039,7 @@ pub mod tests {
(Some(rcstr!("a.js")), rcstr!("b.js")),
(Some(rcstr!("b.js")), rcstr!("c.js")),
(Some(rcstr!("c.js")), rcstr!("a.js")),
// we start following the cycle again
(Some(rcstr!("a.js")), rcstr!("b.js")),
(Some(rcstr!("b.js")), rcstr!("c.js")),
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment