Skip to content

Commit

Permalink
fix: fix compilation using aztec feature flag (#2663)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Sep 12, 2023
1 parent 1114871 commit 7f6fe46
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions compiler/noirc_frontend/src/hir/def_map/aztec_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ use acvm::FieldElement;
use noirc_errors::{CustomDiagnostic, Span};

use crate::graph::CrateId;
use crate::token::SecondaryAttribute;
use crate::{
hir::Context, token::Attribute, BlockExpression, CallExpression, CastExpression, Distinctness,
Expression, ExpressionKind, ForExpression, FunctionReturnType, Ident, ImportStatement,
IndexExpression, LetStatement, Literal, MemberAccessExpression, MethodCallExpression,
NoirFunction, ParsedModule, Path, PathKind, Pattern, Statement, UnresolvedType,
UnresolvedTypeData, Visibility,
hir::Context, BlockExpression, CallExpression, CastExpression, Distinctness, Expression,
ExpressionKind, ForExpression, FunctionReturnType, Ident, ImportStatement, IndexExpression,
LetStatement, Literal, MemberAccessExpression, MethodCallExpression, NoirFunction,
ParsedModule, Path, PathKind, Pattern, Statement, UnresolvedType, UnresolvedTypeData,
Visibility,
};
use noirc_errors::FileDiagnostic;

Expand Down Expand Up @@ -188,17 +189,19 @@ fn check_for_aztec_dependency(
fn transform_module(functions: &mut [NoirFunction]) -> bool {
let mut has_annotated_functions = false;
for func in functions.iter_mut() {
if let Some(Attribute::Custom(custom_attribute)) = func.def.attribute.as_ref() {
match custom_attribute.as_str() {
"aztec(private)" => {
transform_function("Private", func);
has_annotated_functions = true;
for secondary_attribute in func.def.attributes.secondary.clone() {
if let SecondaryAttribute::Custom(custom_attribute) = secondary_attribute {
match custom_attribute.as_str() {
"aztec(private)" => {
transform_function("Private", func);
has_annotated_functions = true;
}
"aztec(public)" => {
transform_function("Public", func);
has_annotated_functions = true;
}
_ => continue,
}
"aztec(public)" => {
transform_function("Public", func);
has_annotated_functions = true;
}
_ => continue,
}
}
}
Expand Down

0 comments on commit 7f6fe46

Please sign in to comment.