Skip to content

Commit

Permalink
chore: improves abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
kobyhallx committed Dec 1, 2023
1 parent b4cbe51 commit 9535423
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl Context {
pub fn get_definition_location_from(&self, location: Location) -> Option<Location> {
let interner = &self.def_interner;

interner.find_location_index(location).and_then(|index| interner.resolve_location(index))
interner.find_location_index(location).and_then(|index| interner.resolve_location(&index.into()))
}

/// Return a Vec of all `contract` declarations in the source code and the functions they contain
Expand Down
4 changes: 2 additions & 2 deletions compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl NodeInterner {
/// The [Location] may not necessarily point to the beginning of the item
/// so we check if the location's span is contained within the start or end
/// of each items [Span]
pub fn find_location_index(&self, location: Location) -> Option<&Index> {
pub fn find_location_index(&self, location: Location) -> Option<impl Into<Index>> {
let mut location_candidate: Option<(&Index, &Location)> = None;

for (index, interned_location) in self.id_to_location.iter() {
Expand All @@ -472,7 +472,7 @@ impl NodeInterner {
}
}
}
location_candidate.map(|(index, _location)| index)
location_candidate.map(|(index, _location)| *index)
}

/// Interns a HIR Function.
Expand Down

0 comments on commit 9535423

Please sign in to comment.