(&self, mut network: NodeNetwork)
| 6 | |
| 7 | impl Compiler { |
| 8 | pub fn compile(&self, mut network: NodeNetwork) -> impl Iterator<Item = Result<ProtoNetwork, String>> { |
| 9 | network.resolve_scope_inputs(); |
| 10 | network.generate_node_paths(&[]); |
| 11 | let node_ids = network.nodes.keys().copied().collect::<Vec<_>>(); |
| 12 | network.populate_dependants(); |
| 13 | for id in node_ids { |
| 14 | network.flatten(id); |
| 15 | } |
| 16 | network.remove_redundant_passthrough_nodes(); |
| 17 | // network.remove_dead_nodes(0); |
| 18 | let proto_networks = network.into_proto_networks(); |
| 19 | |
| 20 | proto_networks.map(move |mut proto_network| { |
| 21 | proto_network.insert_context_nullification_nodes()?; |
| 22 | proto_network.generate_stable_node_ids(); |
| 23 | Ok(proto_network) |
| 24 | }) |
| 25 | } |
| 26 | pub fn compile_single(&self, network: NodeNetwork) -> Result<ProtoNetwork, String> { |
| 27 | assert_eq!(network.exports.len(), 1, "Graph with multiple outputs not yet handled"); |
| 28 | let Some(proto_network) = self.compile(network).next() else { |
no test coverage detected