Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pass import_directive by reference #4511

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@

// Resolve unresolved imports collected from the crate, one by one.
for collected_import in def_collector.collected_imports {
match resolve_import(crate_id, collected_import, &context.def_maps) {
match resolve_import(crate_id, &collected_import, &context.def_maps) {
Ok(resolved_import) => {
// Populate module namespaces according to the imports used
let current_def_map = context.def_maps.get_mut(&crate_id).unwrap();
Expand Down Expand Up @@ -476,7 +476,7 @@
.collect()
}

// TODO(vitkov): Move this out of here and into type_check

Check warning on line 479 in compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (vitkov)
#[allow(clippy::too_many_arguments)]
pub(crate) fn check_methods_signatures(
resolver: &mut Resolver,
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/hir/resolution/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl From<PathResolutionError> for CustomDiagnostic {

pub fn resolve_import(
crate_id: CrateId,
import_directive: ImportDirective,
import_directive: &ImportDirective,
def_maps: &BTreeMap<CrateId, CrateDefMap>,
) -> Result<ResolvedImport, (PathResolutionError, LocalModuleId)> {
let def_map = &def_maps[&crate_id];
Expand All @@ -62,10 +62,10 @@ pub fn resolve_import(

let module_scope = import_directive.module_id;
let resolved_namespace =
resolve_path_to_ns(&import_directive, def_map, def_maps, allow_contracts)
resolve_path_to_ns(import_directive, def_map, def_maps, allow_contracts)
.map_err(|error| (error, module_scope))?;

let name = resolve_path_name(&import_directive);
let name = resolve_path_name(import_directive);
Ok(ResolvedImport {
name,
resolved_namespace,
Expand Down
Loading