Skip to content

Commit

Permalink
Merge branch 'master' into kw/build-aztec-feature-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray authored Oct 31, 2023
2 parents 9001687 + 2c4968b commit 57e118c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions compiler/noirc_frontend/src/hir/aztec_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use crate::{
UnresolvedType, UnresolvedTypeData, Visibility,
};
use crate::{
ForLoopStatement, FunctionDefinition, FunctionVisibility, ImportStatement, NoirStruct,
PrefixExpression, Signedness, StatementKind, StructType, Type, TypeImpl, UnaryOp,
ForLoopStatement, ForRange, FunctionDefinition, FunctionVisibility, ImportStatement,
NoirStruct, PrefixExpression, Signedness, StatementKind, StructType, Type, TypeImpl, UnaryOp,
};
use fm::FileId;

Expand Down Expand Up @@ -873,6 +873,7 @@ fn add_struct_to_hasher(identifier: &Ident) -> Statement {
fn create_loop_over(var: Expression, loop_body: Vec<Statement>) -> Statement {
// If this is an array of primitive types (integers / fields) we can add them each to the hasher
// casted to a field
let span = var.span.clone();

// `array.len()`
let end_range_expression = method_call(
Expand All @@ -887,12 +888,15 @@ fn create_loop_over(var: Expression, loop_body: Vec<Statement>) -> Statement {

// `for i in 0..{ident}.len()`
make_statement(StatementKind::For(ForLoopStatement {
range: ForRange::Range(
expression(ExpressionKind::Literal(Literal::Integer(FieldElement::from(i128::from(
0,
))))),
end_range_expression,
),
identifier: ident("i"),
start_range: expression(ExpressionKind::Literal(Literal::Integer(FieldElement::from(
i128::from(0),
)))),
end_range: end_range_expression,
block: for_loop_block,
span,
}))
}

Expand Down

0 comments on commit 57e118c

Please sign in to comment.