Skip to content

Commit

Permalink
split imports
Browse files Browse the repository at this point in the history
  • Loading branch information
faldor20 committed Mar 11, 2024
1 parent 391b695 commit 2566d0f
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions crates/lang_srv/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,8 @@ impl<'a> AnalyzedDocumentBuilder<'a> {
let declarations;

//lookup the type info for each import from the module where it was exposed
let imports = self
.imports
.remove(&module_id)
.unwrap_or_default()
.into_iter()
.map(|id| {
(
id,
self.modules_info
.exposed
.get(&id)
.unwrap_or(&Arc::new(vec![]))
.clone(),
)
})
.collect::<HashMap<_, _>>();
let this_imports = self.imports.remove(&module_id).unwrap_or_default();
let imports = self.get_symbols_for_imports(this_imports);

let exposed_imports = self.exposed_imports.remove(&module_id).unwrap_or_default();

Expand Down Expand Up @@ -329,6 +315,27 @@ impl<'a> AnalyzedDocumentBuilder<'a> {
}
}

///Gets the exposed symbols, and type info for each imported module
fn get_symbols_for_imports(
&mut self,
imports: MutSet<ModuleId>,
) -> HashMap<ModuleId, Arc<Vec<(Symbol, Variable)>>> {
let imports = imports
.into_iter()
.map(|id| {
(
id,
self.modules_info
.exposed
.get(&id)
.unwrap_or(&Arc::new(vec![]))
.clone(),
)
})
.collect::<HashMap<_, _>>();
imports
}

fn build_diagnostics(
&mut self,
source_path: &Path,
Expand Down

0 comments on commit 2566d0f

Please sign in to comment.