Skip to content

Commit

Permalink
Add simple comments explaining the array index
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Apr 26, 2024
1 parent 62d1257 commit 955f3f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/concrete_ir/src/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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;
Expand Down

0 comments on commit 955f3f8

Please sign in to comment.