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

Commit 6b574c7

Browse files
author
Hendrik van Antwerpen
committed
Short-circuit shadowing test when paths diverge
1 parent e9c7ece commit 6b574c7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

stack-graphs/src/partial.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,9 @@ impl PartialPathEdgeList {
18171817
pub fn shadows(mut self, partials: &mut PartialPaths, mut other: PartialPathEdgeList) -> bool {
18181818
while let Some(self_edge) = self.pop_front(partials) {
18191819
if let Some(other_edge) = other.pop_front(partials) {
1820-
if self_edge.shadows(other_edge) {
1820+
if self_edge.source_node_id != other_edge.source_node_id {
1821+
return false;
1822+
} else if self_edge.shadows(other_edge) {
18211823
return true;
18221824
}
18231825
} else {

stack-graphs/src/paths.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,9 @@ impl PathEdgeList {
494494
pub fn shadows(mut self, paths: &mut Paths, mut other: PathEdgeList) -> bool {
495495
while let Some(self_edge) = self.pop_front(paths) {
496496
if let Some(other_edge) = other.pop_front(paths) {
497-
if self_edge.shadows(other_edge) {
497+
if self_edge.source_node_id != other_edge.source_node_id {
498+
return false;
499+
} else if self_edge.shadows(other_edge) {
498500
return true;
499501
}
500502
} else {

0 commit comments

Comments
 (0)