Skip to content

Commit

Permalink
chore: restrict visibility of pub functions in noirc_frontend (#975)
Browse files Browse the repository at this point in the history
chore: restrict visibility of pub functions
  • Loading branch information
TomAFrench authored Mar 13, 2023
1 parent 9bec92a commit 750c479
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1451,7 +1451,7 @@ mod test {
}

impl TestPathResolver {
pub fn insert_func(&mut self, name: String, func_id: FuncId) {
fn insert_func(&mut self, name: String, func_id: FuncId) {
self.0.insert(name, func_id.into());
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/type_check/errors.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use noirc_errors::CustomDiagnostic as Diagnostic;
pub use noirc_errors::Span;
use noirc_errors::Span;
use thiserror::Error;

use crate::hir_def::expr::HirBinaryOp;
Expand Down
8 changes: 4 additions & 4 deletions crates/noirc_frontend/src/hir/type_check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ fn bind_function_type(
}
}

pub fn prefix_operand_type_rules(op: &crate::UnaryOp, rhs_type: &Type) -> Result<Type, String> {
fn prefix_operand_type_rules(op: &crate::UnaryOp, rhs_type: &Type) -> Result<Type, String> {
match op {
crate::UnaryOp::Minus => {
if !matches!(rhs_type, Type::Integer(..) | Type::Error) {
Expand All @@ -505,7 +505,7 @@ pub fn prefix_operand_type_rules(op: &crate::UnaryOp, rhs_type: &Type) -> Result

// Given a binary operator and another type. This method will produce the output type
// XXX: Review these rules. In particular, the interaction between integers, comptime and private/public variables
pub fn infix_operand_type_rules(
fn infix_operand_type_rules(
lhs_type: &Type,
op: &HirBinaryOp,
rhs_type: &Type,
Expand Down Expand Up @@ -689,7 +689,7 @@ fn check_constructor(
Type::Struct(typ, generics)
}

pub fn check_member_access(
fn check_member_access(
access: expr::HirMemberAccess,
interner: &mut NodeInterner,
expr_id: ExprId,
Expand Down Expand Up @@ -727,7 +727,7 @@ pub fn check_member_access(
Type::Error
}

pub fn comparator_operand_type_rules(
fn comparator_operand_type_rules(
lhs_type: &Type,
rhs_type: &Type,
op: &HirBinaryOp,
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/type_check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ mod test {
}

impl TestPathResolver {
pub fn insert_func(&mut self, name: String, func_id: FuncId) {
fn insert_func(&mut self, name: String, func_id: FuncId) {
self.0.insert(name, func_id.into());
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_frontend/src/hir/type_check/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub(crate) fn type_check(

/// Associate a given HirPattern with the given Type, and remember
/// this association in the NodeInterner.
pub fn bind_pattern(
pub(crate) fn bind_pattern(
interner: &mut NodeInterner,
pattern: &HirPattern,
typ: Type,
Expand Down
1 change: 1 addition & 0 deletions crates/noirc_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! perform optimizations, convert to ACIR and eventually prove/verify the program.
#![forbid(unsafe_code)]
#![warn(unused_crate_dependencies, unused_extern_crates)]
#![warn(unreachable_pub)]

pub mod ast;
pub mod graph;
Expand Down

0 comments on commit 750c479

Please sign in to comment.