Skip to content

Commit

Permalink
migrate xref v2 to key
Browse files Browse the repository at this point in the history
Summary: as per title; see D55317086 for details

Reviewed By: alanz

Differential Revision: D55317090

fbshipit-source-id: a7e364a421b9c347873f09814bcfef74821ffe6e
  • Loading branch information
perehonchuk authored and facebook-github-bot committed Apr 5, 2024
1 parent feb2493 commit 661ec8d
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions crates/elp/src/bin/glean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,7 @@ pub(crate) enum Fact {
#[serde(rename = "erlang.Declaration")]
Declaration { facts: Vec<Key<FileDeclaration>> },
#[serde(rename = "erlang.XRefsByFile")]
XRefV2 { facts: Vec<XRefKey> },
}

#[derive(Serialize, Debug)]
pub(crate) struct XRefKey {
key: XRefFile,
XRefV2 { facts: Vec<Key<XRefFile>> },
}

#[derive(Serialize, Debug)]
Expand Down Expand Up @@ -415,19 +410,21 @@ impl IndexedFacts {
fn to_v2_facts(mut self) -> Vec<Fact> {
let file_lines_fact = mem::take(&mut self.file_line_facts);
let file_lines_fact = file_lines_fact.into_iter().map_into().collect();
let file_decl = mem::take(&mut self.file_declarations);
let file_decl = file_decl.into_iter().map_into().collect();
let xref = mem::take(&mut self.xref_v2);
let xref = xref.into_iter().map(|x| XRefKey { key: x }).collect();
let declaration_fact = mem::take(&mut self.file_declarations);
let declaration_fact = declaration_fact.into_iter().map_into().collect();
let xref_fact = mem::take(&mut self.xref_v2);
let xref_fact = xref_fact.into_iter().map_into().collect();
vec![
Fact::File {
facts: mem::take(&mut self.file_facts),
},
Fact::FileLine {
facts: file_lines_fact,
},
Fact::Declaration { facts: file_decl },
Fact::XRefV2 { facts: xref },
Fact::Declaration {
facts: declaration_fact,
},
Fact::XRefV2 { facts: xref_fact },
]
}
}
Expand Down

0 comments on commit 661ec8d

Please sign in to comment.