From 955f3f8c7dfa10637c21ea90f51515d6b4c50d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Gonz=C3=A1lez=20Calder=C3=B3n?= Date: Fri, 26 Apr 2024 15:55:11 -0300 Subject: [PATCH] Add simple comments explaining the array index --- crates/concrete_ir/src/lowering.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/concrete_ir/src/lowering.rs b/crates/concrete_ir/src/lowering.rs index 56183a6..9cee0ba 100644 --- a/crates/concrete_ir/src/lowering.rs +++ b/crates/concrete_ir/src/lowering.rs @@ -1522,14 +1522,13 @@ pub fn lower_path( } if let TyKind::Array(element_type, _) = ty.kind { + // Assign the index expression to a temporary local let (index, index_ty) = lower_value_expr(builder, expression, None)?; - let index_local = builder.add_temp_local(index_ty.kind); let index_place = Place { local: index_local, projection: vec![], }; - builder.statements.push(Statement { span: None, kind: StatementKind::StorageLive(index_local), @@ -1539,6 +1538,7 @@ pub fn lower_path( kind: StatementKind::Assign(index_place.clone(), index), }); + // Use the local's value as index of the array projection.push(PlaceElem::Index(index_local)); ty = *element_type;