From 40b832432e83bf205486468b8abc1fd0d27fc51f Mon Sep 17 00:00:00 2001 From: Koby Date: Fri, 1 Dec 2023 14:30:53 +0100 Subject: [PATCH] chore: remove unwanted `index` accessor --- compiler/noirc_frontend/src/hir/mod.rs | 2 +- compiler/noirc_frontend/src/node_interner.rs | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/compiler/noirc_frontend/src/hir/mod.rs b/compiler/noirc_frontend/src/hir/mod.rs index f488dd9bd1c..d662a34e694 100644 --- a/compiler/noirc_frontend/src/hir/mod.rs +++ b/compiler/noirc_frontend/src/hir/mod.rs @@ -181,7 +181,7 @@ impl Context { } /// Returns the [Location] of the definition of the given Ident found at [Span] - /// Return [None] when definition is not found. + /// Returns [None] when definition is not found. pub fn find_definition_location( &self, file: FileId, diff --git a/compiler/noirc_frontend/src/node_interner.rs b/compiler/noirc_frontend/src/node_interner.rs index 90a85cc3c44..425a7dc18a9 100644 --- a/compiler/noirc_frontend/src/node_interner.rs +++ b/compiler/noirc_frontend/src/node_interner.rs @@ -363,15 +363,6 @@ impl DefinitionInfo { pub fn is_global(&self) -> bool { self.kind.is_global() } - - pub fn get_index(&self) -> Option { - match self.kind { - DefinitionKind::Function(func_id) => Some(func_id.0), - DefinitionKind::Global(stmt_id) => Some(stmt_id.0), - DefinitionKind::Local(expr_id) => expr_id.map(|id| Some(id.0)).unwrap_or(None), - DefinitionKind::GenericType(_) => None, - } - } } #[derive(Debug, Clone, Eq, PartialEq)] @@ -1221,10 +1212,10 @@ impl NodeInterner { self.selected_trait_implementations.get(&ident_id).cloned() } - pub fn resolve_location(&self, index: &Index) -> Option { - self.nodes.get(*index).and_then(|def| match def { + pub fn resolve_location(&self, index_id: &Index) -> Option { + self.nodes.get(*index_id).and_then(|def| match def { Node::Function(func) => { - self.resolve_location(&func.as_expr().0) + self.resolve_location(&func.as_expr().into()) } Node::Expression(expression) => { match expression {