Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit 82d03db

Browse files
author
Hendrik van Antwerpen
committed
Drop legacy compatibility stitcher
1 parent 2974046 commit 82d03db

File tree

1 file changed

+0
-75
lines changed

1 file changed

+0
-75
lines changed

stack-graphs/src/stitching.rs

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -725,11 +725,8 @@ pub struct ForwardPartialPathStitcher {
725725
max_work_per_phase: usize,
726726
#[cfg(feature = "copious-debugging")]
727727
phase_number: usize,
728-
should_extend: Box<ShouldExtend>,
729728
}
730729

731-
type ShouldExtend = dyn Fn(&StackGraph, &mut PartialPaths, &PartialPath) -> bool;
732-
733730
impl ForwardPartialPathStitcher {
734731
/// Creates a new forward partial path stitcher that is "seeded" with a set of starting stack
735732
/// graph nodes.
@@ -787,7 +784,6 @@ impl ForwardPartialPathStitcher {
787784
max_work_per_phase: usize::MAX,
788785
#[cfg(feature = "copious-debugging")]
789786
phase_number: 1,
790-
should_extend: Box::new(|_, _, _| true),
791787
}
792788
}
793789

@@ -813,7 +809,6 @@ impl ForwardPartialPathStitcher {
813809
max_work_per_phase: usize::MAX,
814810
#[cfg(feature = "copious-debugging")]
815811
phase_number: 1,
816-
should_extend: Box::new(|_, _, _| true),
817812
}
818813
}
819814

@@ -938,10 +933,6 @@ impl ForwardPartialPathStitcher {
938933
"--> Candidate partial path {}",
939934
partial_path.display(graph, partials)
940935
);
941-
if !(self.should_extend)(graph, partials, &partial_path) {
942-
copious_debugging!(" Should not extend");
943-
continue;
944-
}
945936
if !self
946937
.cycle_detector
947938
.should_process_path(&partial_path, |probe| {
@@ -1000,70 +991,4 @@ impl ForwardPartialPathStitcher {
1000991
}
1001992
Ok(())
1002993
}
1003-
1004-
/// Finds a set of locally complete partial paths, calling the `visit` closure for each one.
1005-
///
1006-
/// This functions computes paths that
1007-
/// (a) start at references, exported scopes, or the root,
1008-
/// (b) end at definitions, exported scopes, jump-to-scope nodes, or the root, and
1009-
/// (c) do not go through the root node.
1010-
/// If the partial paths in de provided database are file-local, the resutling paths set will
1011-
/// contain all paths that are locally complete, or end at a file boundary. The set of paths
1012-
/// may contain paths that can be constructed by stitching other paths in the result set.
1013-
///
1014-
/// This function will not return until all reachable partial paths have been processed, so
1015-
/// your database must already contain all partial paths that might be needed. If you have a
1016-
/// very large stack graph stored in some other storage system, and want more control over
1017-
/// lazily loading only the necessary pieces, then you should code up your own loop that calls
1018-
/// [`process_next_phase`][] manually.
1019-
///
1020-
/// [`process_next_phase`]: #method.process_next_phase
1021-
#[deprecated = "This method replicates old PartialPaths::find_all_partial_paths_in_file behavior. It has poor performance because it computes more paths than necessary, and users should use PartialPaths::find_minimal_partial_paths_set_in_file instead."]
1022-
pub fn find_locally_complete_partial_paths<F>(
1023-
graph: &StackGraph,
1024-
partials: &mut PartialPaths,
1025-
db: &mut Database,
1026-
cancellation_flag: &dyn CancellationFlag,
1027-
mut visit: F,
1028-
) -> Result<(), CancellationError>
1029-
where
1030-
F: FnMut(&StackGraph, &mut PartialPaths, &PartialPath),
1031-
{
1032-
fn is_start_node(graph: &StackGraph, node: Handle<Node>) -> bool {
1033-
let node = &graph[node];
1034-
node.is_reference() || node.is_exported_scope() || node.is_root()
1035-
}
1036-
fn is_complete(graph: &StackGraph, path: &PartialPath) -> bool {
1037-
let start_node = &graph[path.start_node];
1038-
let end_node = &graph[path.end_node];
1039-
let start_ok = path.starts_at_reference(graph)
1040-
|| start_node.is_root()
1041-
|| start_node.is_exported_scope();
1042-
let end_ok = path.ends_at_definition(graph)
1043-
|| end_node.is_exported_scope()
1044-
|| end_node.is_root()
1045-
|| end_node.is_jump_to();
1046-
start_ok && end_ok
1047-
}
1048-
let starting_nodes = graph
1049-
.iter_nodes()
1050-
.filter(|node| is_start_node(graph, *node))
1051-
.collect::<Vec<_>>();
1052-
let mut stitcher =
1053-
ForwardPartialPathStitcher::from_nodes(graph, partials, db, starting_nodes);
1054-
stitcher.should_extend =
1055-
Box::new(|g, _ps, p| p.edges.is_empty() || !g[p.end_node].is_root());
1056-
while !stitcher.is_complete() {
1057-
cancellation_flag.check("finding complete partial paths")?;
1058-
let partial_paths = stitcher
1059-
.previous_phase_partial_paths()
1060-
.filter(|partial_path| is_complete(graph, partial_path))
1061-
.collect::<Vec<_>>();
1062-
for path in partial_paths {
1063-
visit(graph, partials, path);
1064-
}
1065-
stitcher.process_next_phase(graph, partials, db);
1066-
}
1067-
Ok(())
1068-
}
1069994
}

0 commit comments

Comments
 (0)