Skip to content

Commit

Permalink
Merge branch 'master' of github.com:noir-lang/noir into jb-constructo…
Browse files Browse the repository at this point in the history
…r-formatter
  • Loading branch information
jonybur committed Oct 11, 2023
2 parents 3e9771d + cf42de8 commit 39f3b73
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
6 changes: 5 additions & 1 deletion acvm-repo/acvm/src/compiler/transformers/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ impl FallbackTransformer {
}

Ok((
Circuit { current_witness_index: witness_idx, opcodes: acir_supported_opcodes, ..acir },
Circuit {
current_witness_index: witness_idx - 1,
opcodes: acir_supported_opcodes,
..acir
},
new_opcode_positions,
))
}
Expand Down
4 changes: 4 additions & 0 deletions tooling/nargo_fmt/src/visitor/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ impl FmtVisitor<'_> {
.join(", ");
format!("{} {{ {} }}", type_str, formatted_fields)
}
ExpressionKind::MemberAccess(member_access_expr) => {
let lhs_str = self.format_expr(member_access_expr.lhs);
format!("{}.{}", lhs_str, member_access_expr.rhs)
}
ExpressionKind::Index(index_expr) => {
let formatted_collection =
self.format_expr(index_expr.collection).trim_end().to_string();
Expand Down
15 changes: 15 additions & 0 deletions tooling/nargo_fmt/tests/expected/member_access.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct Address {
city: String,
country: String,
}

struct Person {
name: String,
age: u8,
address: Address,
}

fn foo(p: Person) {
p.name;
p.address.country;
}
15 changes: 15 additions & 0 deletions tooling/nargo_fmt/tests/input/member_access.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
struct Address {
city: String,
country: String,
}

struct Person {
name: String,
age: u8,
address: Address,
}

fn foo(p: Person) {
p . name;
p.address . country;
}

0 comments on commit 39f3b73

Please sign in to comment.