From c3921497e6d5734b90e2162dbbd57139dd743f4f Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Tue, 21 Jan 2025 19:56:25 +0000 Subject: [PATCH] Minor refactor of group edge code --- src/api/sorting/plugin_graph.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/api/sorting/plugin_graph.cpp b/src/api/sorting/plugin_graph.cpp index a6d829e7..50fc265b 100644 --- a/src/api/sorting/plugin_graph.cpp +++ b/src/api/sorting/plugin_graph.cpp @@ -222,26 +222,22 @@ public: // Add the edge to the stack so that its providence can be taken into // account when adding edges from this source group and previous groups' // plugins. - edgeStack_.push_back(std::make_pair(edge, std::vector())); + // Also record the plugins in the edge's source group, unless the source + // group should be ignored (e.g. because the visitor has been configured + // to ignore the default group's plugins as sources). + edgeStack_.push_back(std::make_pair( + edge, + ShouldIgnoreSourceVertex(source) ? std::vector() + : FindPluginsInGroup(source, graph))); // Find the plugins in the target group. const auto targetPlugins = FindPluginsInGroup(target, graph); - // Add edges going from all the plugins in the previous groups in the path - // being currently walked, to the plugins in the current target group's - // plugins. + // Add edges going from all the plugins in the groups in the path being + // currently walked, to the plugins in the current target group's plugins. for (size_t i = 0; i < edgeStack_.size(); i += 1) { AddPluginGraphEdges(i, targetPlugins, graph); } - - // For each source plugin, add an edge to each target plugin, unless the - // source group should be ignored (e.g. because the visitor has been - // configured to ignore the default group's plugins as sources). - if (!ShouldIgnoreSourceVertex(source)) { - edgeStack_.back().second = FindPluginsInGroup(source, graph); - - AddPluginGraphEdges(edgeStack_.size() - 1, targetPlugins, graph); - } } void forward_or_cross_edge(GroupGraphEdge edge, const GroupGraph& graph) {