make resolve passes public

This commit is contained in:
Evan Almloff committed 2022-11-25 11:45:47 -06:00
1 parent c7eeeef68e
commit 26d4e48480
1 file changed
+6 -12
+6 -12
View File
@@ -829,23 +829,17 @@ fn traverse_breadth_first() {
}); });
} }
enum PassDirection {
Up,
Down,
Node,
}
#[derive(PartialEq, Eq, Hash, Clone, Copy)] #[derive(PartialEq, Eq, Hash, Clone, Copy)]
struct PassId(u64); pub struct PassId(u64);
trait UpwardPass<T> { pub trait UpwardPass<T> {
fn pass_id(&self) -> PassId; fn pass_id(&self) -> PassId;
fn dependancies(&self) -> &'static [PassId]; fn dependancies(&self) -> &'static [PassId];
fn dependants(&self) -> &'static [PassId]; fn dependants(&self) -> &'static [PassId];
fn upward_pass(&self, node: &mut T, parent: Option<&mut T>) -> bool; fn upward_pass(&self, node: &mut T, parent: Option<&mut T>) -> bool;
} }
trait DownwardPass<T> { pub trait DownwardPass<T> {
fn pass_id(&self) -> PassId; fn pass_id(&self) -> PassId;
fn dependancies(&self) -> &'static [PassId]; fn dependancies(&self) -> &'static [PassId];
fn dependants(&self) -> &'static [PassId]; fn dependants(&self) -> &'static [PassId];
@@ -856,14 +850,14 @@ trait DownwardPass<T> {
) -> bool; ) -> bool;
} }
trait NodePass<T> { pub trait NodePass<T> {
fn pass_id(&self) -> PassId; fn pass_id(&self) -> PassId;
fn dependancies(&self) -> &'static [PassId]; fn dependancies(&self) -> &'static [PassId];
fn dependants(&self) -> &'static [PassId]; fn dependants(&self) -> &'static [PassId];
fn node_pass(&self, node: &mut T) -> bool; fn node_pass(&self, node: &mut T) -> bool;
} }
enum AnyPass<T> { pub enum AnyPass<T> {
Upward(Box<dyn UpwardPass<T> + Send + Sync>), Upward(Box<dyn UpwardPass<T> + Send + Sync>),
Downward(Box<dyn DownwardPass<T> + Send + Sync>), Downward(Box<dyn DownwardPass<T> + Send + Sync>),
Node(Box<dyn NodePass<T> + Send + Sync>), Node(Box<dyn NodePass<T> + Send + Sync>),
@@ -954,7 +948,7 @@ impl DirtyNodeStates {
} }
} }
fn resolve_passes<T>( pub fn resolve_passes<T>(
tree: &mut impl TreeView<T>, tree: &mut impl TreeView<T>,
starting_nodes: FxHashMap<NodeId, FxDashSet<PassId>>, starting_nodes: FxHashMap<NodeId, FxDashSet<PassId>>,
mut passes: Vec<AnyPass<T>>, mut passes: Vec<AnyPass<T>>,