harn_modules/
typecheck.rs1use std::path::Path;
4
5use harn_parser::analysis::TypeCheckConfig;
6use harn_parser::NamespaceImportBinding;
7
8use crate::ModuleGraph;
9
10impl ModuleGraph {
11 pub fn typecheck_import_config_for_file(&self, file: &Path) -> TypeCheckConfig {
17 let namespace_imports = self
18 .namespace_imports_for_file(file)
19 .unwrap_or_default()
20 .into_iter()
21 .map(|info| {
22 (
23 info.alias,
24 NamespaceImportBinding::from_member_signatures(
25 info.raw_path,
26 info.member_names.into_iter().collect(),
27 info.member_signatures,
28 ),
29 )
30 })
31 .collect();
32
33 TypeCheckConfig::new()
34 .with_imported_names(self.imported_names_for_file(file))
35 .with_imported_type_decls(
36 self.imported_type_declarations_for_file(file)
37 .unwrap_or_default(),
38 )
39 .with_imported_callable_decls(
40 self.imported_callable_declarations_for_file(file)
41 .unwrap_or_default(),
42 )
43 .with_namespace_imports(namespace_imports)
44 }
45}