Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Jul 7, 2023
1 parent 59b60e2 commit 33d4834
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
21 changes: 11 additions & 10 deletions crates/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ impl<'a> Resolver<'a> {
kind: func.kind,
attributes,
contract_function_type: self.handle_function_type(func),
is_contract_function_internal: self.handle_is_function_internal(func),
is_internal: self.handle_is_function_internal(func),
is_unconstrained: func.def.is_unconstrained,
location,
typ,
Expand Down Expand Up @@ -710,15 +710,16 @@ impl<'a> Resolver<'a> {
}

fn handle_is_function_internal(&mut self, func: &NoirFunction) -> Option<bool> {
if self.in_contract() {
Some(func.def.is_internal)
} else {
if func.def.is_internal {
self.push_err(ResolverError::ContractFunctionInternalInNormalFunction {
span: func.name_ident().span(),
});
None
}
if self.in_contract() {
Some(func.def.is_internal)
} else {
if func.def.is_internal {
self.push_err(ResolverError::ContractFunctionInternalInNormalFunction {
span: func.name_ident().span(),
});
}
None
}
}

fn declare_numeric_generics(&mut self, params: &[Type], return_type: &Type) {
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 @@ -232,7 +232,7 @@ mod test {
attributes: None,
location,
contract_function_type: None,
is_contract_function_internal: None,
is_internal: None,
is_unconstrained: false,
typ: Type::Function(vec![Type::field(None), Type::field(None)], Box::new(Type::Unit)),
parameters: vec![
Expand Down
3 changes: 2 additions & 1 deletion crates/noirc_frontend/src/hir_def/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ pub struct FuncMeta {

/// This function's visibility.
/// If this function is internal can only be called by itself.
pub is_contract_function_internal: Option<bool>,
/// Will be None if not in contract.
pub is_internal: Option<bool>,

pub is_unconstrained: bool,

Expand Down

0 comments on commit 33d4834

Please sign in to comment.