mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
simplify local_successors
This commit is contained in:
parent
cee1a787c9
commit
14b53c0ccf
2 changed files with 10 additions and 21 deletions
|
@ -438,11 +438,9 @@ pub fn sort_can_defs(
|
|||
}
|
||||
|
||||
let mut defined_symbols: Vec<Symbol> = Vec::new();
|
||||
let mut defined_symbols_set: ImSet<Symbol> = ImSet::default();
|
||||
|
||||
for symbol in can_defs_by_symbol.keys() {
|
||||
defined_symbols.push(*symbol);
|
||||
defined_symbols_set.insert(*symbol);
|
||||
}
|
||||
|
||||
// Use topological sort to reorder the defs based on their dependencies to one another.
|
||||
|
@ -490,7 +488,7 @@ pub fn sort_can_defs(
|
|||
}
|
||||
|
||||
// remove anything that is not defined in the current block
|
||||
loc_succ.retain(|key| defined_symbols_set.contains(key));
|
||||
loc_succ.retain(|key| defined_symbols.contains(key));
|
||||
|
||||
loc_succ
|
||||
}
|
||||
|
@ -533,7 +531,7 @@ pub fn sort_can_defs(
|
|||
}
|
||||
|
||||
// remove anything that is not defined in the current block
|
||||
loc_succ.retain(|key| defined_symbols_set.contains(key));
|
||||
loc_succ.retain(|key| defined_symbols.contains(key));
|
||||
|
||||
loc_succ
|
||||
}
|
||||
|
@ -552,7 +550,7 @@ pub fn sort_can_defs(
|
|||
// NOTE: if the symbol is a closure we DONT look into its body
|
||||
|
||||
// remove anything that is not defined in the current block
|
||||
loc_succ.retain(|key| defined_symbols_set.contains(key));
|
||||
loc_succ.retain(|key| defined_symbols.contains(key));
|
||||
|
||||
// NOTE: direct recursion does matter here: `x = x` is invalid recursion!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue