Skip to content

Commit

Permalink
unify processing of refs
Browse files Browse the repository at this point in the history
  • Loading branch information
wkarwacki committed Aug 2, 2024
1 parent ce29da8 commit d1355fd
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/lib/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,15 @@ impl Context {

pub(crate) fn op_refs(&self, op: &Op) -> Vec<(Option<String>, Vec<String>)> {
let refs = op.refs();
let grouped = refs.iter().into_group_map_by(|r#ref| r#ref.src.clone());
grouped
.iter()
.map(|(src, refs)| {
(
src.clone(),
refs.iter()
.map(|r#ref| r#ref.class_name())
.collect::<Vec<_>>(),
)
})
.collect()
self.src_to_refs(refs);
}

pub(crate) fn def_refs(&self, def: &Def) -> Vec<(Option<String>, Vec<String>)> {
let refs = def.refs();
self.src_to_refs(refs);
}

fn src_to_refs(&self, refs: &Vec<Ref>) -> Vec<(Option<String>, Vec<String>)> {
let grouped = refs.iter().into_group_map_by(|r#ref| r#ref.src.clone());
grouped
.iter()
Expand Down

0 comments on commit d1355fd

Please sign in to comment.