mirror of
https://github.com/AleoHQ/leo.git
synced 2024-12-11 10:22:33 +03:00
Merge pull request #853 from AleoHQ/bug/nested-access-fix
Reversed-Accesses
This commit is contained in:
commit
817b7e0157
@ -472,7 +472,7 @@ impl ReconstructingReducer for Canonicalizer {
|
||||
Expression::Value(value_expr) if assign.operation != AssignOperation::Assign => {
|
||||
let mut left = Box::new(Expression::Identifier(assignee.identifier.clone()));
|
||||
|
||||
for access in assignee.accesses.iter().rev() {
|
||||
for access in assignee.accesses.iter() {
|
||||
match self.canonicalize_assignee_access(&access) {
|
||||
AssigneeAccess::ArrayIndex(index) => {
|
||||
left = Box::new(Expression::ArrayAccess(ArrayAccessExpression {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,11 @@
|
||||
circuit Foo {
|
||||
f: u8,
|
||||
y: (u8, u8),
|
||||
|
||||
function z (mut self) -> u16 {
|
||||
self.y.0 += 1u8;
|
||||
return 1u16
|
||||
}
|
||||
}
|
||||
function main() {
|
||||
let x = 10u32;
|
||||
@ -14,7 +20,15 @@ function main() {
|
||||
z.1 += 3u8;
|
||||
console.assert(z.1 == 5u8);
|
||||
|
||||
let foo = Foo { f: 6u8 };
|
||||
let foo = Foo { f: 6u8, y: (1u8, 1u8) };
|
||||
foo.f += 2u8;
|
||||
console.assert(foo.f == 8u8);
|
||||
|
||||
let a = [[0u8; 1]; 4];
|
||||
a[2][0] += 1u8;
|
||||
console.assert(a[2][0] == 1u8);
|
||||
|
||||
let b = [0u8; (4, 1)];
|
||||
b[2][0] += 1u8;
|
||||
console.assert(a[2][0] == 1u8);
|
||||
}
|
Loading…
Reference in New Issue
Block a user