diff --git a/aztec_macros/src/lib.rs b/aztec_macros/src/lib.rs
index f9df3f10129..c21e26bdcad 100644
--- a/aztec_macros/src/lib.rs
+++ b/aztec_macros/src/lib.rs
@@ -10,18 +10,19 @@ use noirc_frontend::macros_api::parse_program;
use noirc_frontend::macros_api::FieldElement;
use noirc_frontend::macros_api::{
BlockExpression, CallExpression, CastExpression, Distinctness, Expression, ExpressionKind,
- ForLoopStatement, ForRange, FunctionDefinition, FunctionReturnType, FunctionVisibility,
- HirContext, HirExpression, HirLiteral, HirStatement, Ident, IndexExpression, LetStatement,
- Literal, MemberAccessExpression, MethodCallExpression, NoirFunction, NoirStruct, Param, Path,
- PathKind, Pattern, PrefixExpression, SecondaryAttribute, Signedness, Span, Statement,
- StatementKind, StructType, Type, TypeImpl, UnaryOp, UnresolvedType, UnresolvedTypeData,
- Visibility,
+ ForLoopStatement, ForRange, FunctionDefinition, FunctionReturnType, HirContext, HirExpression,
+ HirLiteral, HirStatement, Ident, IndexExpression, LetStatement, Literal,
+ MemberAccessExpression, MethodCallExpression, NoirFunction, NoirStruct, Param, Path, PathKind,
+ Pattern, PrefixExpression, SecondaryAttribute, Signedness, Span, Statement, StatementKind,
+ StructType, Type, TypeImpl, UnaryOp, UnresolvedType, UnresolvedTypeData, Visibility,
};
use noirc_frontend::macros_api::{CrateId, FileId};
use noirc_frontend::macros_api::{MacroError, MacroProcessor};
use noirc_frontend::macros_api::{ModuleDefId, NodeInterner, SortedModule, StructId};
use noirc_frontend::node_interner::{FuncId, TraitId, TraitImplId, TraitImplKind};
-use noirc_frontend::{BinaryOpKind, ConstrainKind, ConstrainStatement, InfixExpression, Lambda};
+use noirc_frontend::{
+ BinaryOpKind, ConstrainKind, ConstrainStatement, InfixExpression, ItemVisibility, Lambda,
+};
pub struct AztecMacro;
impl MacroProcessor for AztecMacro {
@@ -1100,7 +1101,7 @@ fn generate_selector_impl(structure: &NoirStruct) -> TypeImpl {
&return_type,
);
- selector_fn_def.visibility = FunctionVisibility::Public;
+ selector_fn_def.visibility = ItemVisibility::Public;
// Seems to be necessary on contract modules
selector_fn_def.return_visibility = Visibility::Public;
diff --git a/compiler/noirc_frontend/src/ast/expression.rs b/compiler/noirc_frontend/src/ast/expression.rs
index 2a252633a29..def1b082890 100644
--- a/compiler/noirc_frontend/src/ast/expression.rs
+++ b/compiler/noirc_frontend/src/ast/expression.rs
@@ -3,7 +3,7 @@ use std::fmt::Display;
use crate::token::{Attributes, Token};
use crate::{
- Distinctness, FunctionVisibility, Ident, Path, Pattern, Recoverable, Statement, StatementKind,
+ Distinctness, Ident, ItemVisibility, Path, Pattern, Recoverable, Statement, StatementKind,
UnresolvedTraitConstraint, UnresolvedType, UnresolvedTypeData, Visibility,
};
use acvm::FieldElement;
@@ -378,7 +378,7 @@ pub struct FunctionDefinition {
pub is_unconstrained: bool,
/// Indicate if this function was defined with the 'pub' keyword
- pub visibility: FunctionVisibility,
+ pub visibility: ItemVisibility,
pub generics: UnresolvedGenerics,
pub parameters: Vec,
@@ -677,7 +677,7 @@ impl FunctionDefinition {
is_open: false,
is_internal: false,
is_unconstrained: false,
- visibility: FunctionVisibility::Private,
+ visibility: ItemVisibility::Private,
generics: generics.clone(),
parameters: p,
body: body.clone(),
diff --git a/compiler/noirc_frontend/src/ast/mod.rs b/compiler/noirc_frontend/src/ast/mod.rs
index 29edbaca594..8a420c32fb8 100644
--- a/compiler/noirc_frontend/src/ast/mod.rs
+++ b/compiler/noirc_frontend/src/ast/mod.rs
@@ -354,8 +354,8 @@ impl UnresolvedTypeExpression {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
-/// Represents whether the function can be called outside its module/crate
-pub enum FunctionVisibility {
+/// Represents whether the definition can be referenced outside its module/crate
+pub enum ItemVisibility {
Public,
Private,
PublicCrate,
diff --git a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
index 5b2f815d636..6ac263d80be 100644
--- a/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
+++ b/compiler/noirc_frontend/src/hir/def_collector/dc_mod.rs
@@ -394,7 +394,7 @@ impl<'a> ModCollector<'a> {
let modifiers = FunctionModifiers {
name: name.to_string(),
- visibility: crate::FunctionVisibility::Public,
+ visibility: crate::ItemVisibility::Public,
// TODO(Maddiaa): Investigate trait implementations with attributes see: https://github.com/noir-lang/noir/issues/2629
attributes: crate::token::Attributes::empty(),
is_unconstrained: false,
diff --git a/compiler/noirc_frontend/src/hir/def_map/item_scope.rs b/compiler/noirc_frontend/src/hir/def_map/item_scope.rs
index 523def89518..178b91e1e84 100644
--- a/compiler/noirc_frontend/src/hir/def_map/item_scope.rs
+++ b/compiler/noirc_frontend/src/hir/def_map/item_scope.rs
@@ -1,16 +1,11 @@
use super::{namespace::PerNs, ModuleDefId, ModuleId};
use crate::{
node_interner::{FuncId, TraitId},
- Ident,
+ Ident, ItemVisibility,
};
use std::collections::{hash_map::Entry, HashMap};
-type Scope = HashMap