Skip to content

Commit

Permalink
fix: impl Into<Index>
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Dec 1, 2023
1 parent c499cfa commit 396e6d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions compiler/noirc_frontend/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +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.into()))
interner.find_location_index(location).and_then(|index| interner.resolve_location(index))
}

/// Return a Vec of all `contract` declarations in the source code and the functions they contain
Expand Down
6 changes: 3 additions & 3 deletions compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,11 @@ impl NodeInterner {
/// For a given [Index] we return [Location] to which we resolved to
/// We currently return None for features not yet implemented
/// TODO(#3659): LSP goto def should error when Ident at Location could not resolve
pub(crate) fn resolve_location(&self, index_id: &Index) -> Option<Location> {
let node = self.nodes.get(*index_id)?;
pub(crate) fn resolve_location(&self, index: impl Into<Index>) -> Option<Location> {
let node = self.nodes.get(index.into())?;

match node {
Node::Function(func) => self.resolve_location(&func.as_expr().into()),
Node::Function(func) => self.resolve_location(func.as_expr()),
Node::Expression(expression) => self.resolve_expression_location(expression),
_ => None,
}
Expand Down

0 comments on commit 396e6d1

Please sign in to comment.