From c763d515511bb336d8ebbcf82a8cda161e2fc310 Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 22 Apr 2022 15:01:53 +0200 Subject: [PATCH] use new sccs in error case too --- compiler/can/src/def.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/compiler/can/src/def.rs b/compiler/can/src/def.rs index 815f7a13e7..424fcd8fbd 100644 --- a/compiler/can/src/def.rs +++ b/compiler/can/src/def.rs @@ -976,13 +976,13 @@ pub fn sort_can_defs_improved( // // foo = if b then foo else bar - let all_successors_without_self = |id: &u32| { - let id = *id; - def_ids.successors_without_self(id) - }; + let sccs = strongly_connected_components_improved( + def_ids.length as usize, + &def_ids.references, + &nodes_in_cycle, + ); - for cycle in strongly_connected_components(&nodes_in_cycle, all_successors_without_self) - { + for cycle in sccs { // check whether the cycle is faulty, which is when it has // a direct successor in the current cycle. This catches things like: // @@ -1063,7 +1063,7 @@ pub fn sort_can_defs_improved( // for each symbol in this group for symbol in &groups[*group_id] { // find its successors - for succ in all_successors_without_self(symbol) { + for succ in def_ids.successors_without_self(*symbol) { // and add its group to the result match symbol_to_group_index.get(&succ) { Some(index) => {