quick fix, it's in order in this location not reversed, add tests

This commit is contained in:
gluax 2021-04-09 22:52:14 -04:00
parent c336f5a704
commit 2bb85f52c1
3 changed files with 711 additions and 147 deletions

View File

@ -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

View File

@ -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,11 @@ 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);
}