@@ -55,13 +55,9 @@ impl AcirMem {
55
55
// Loads the associated `InternalVar` for the element
56
56
// in the `array` at the given `offset`.
57
57
//
58
- // First we check if the address of the array element
59
- // is in the memory_map. If not, then we check the `array`
58
+ // We check if the address of the array element
59
+ // is in the memory_map.
60
60
//
61
- // We do not check the `MemArray` initially because the
62
- // `MemoryMap` holds the most updated InternalVar
63
- // associated to the array element.
64
- // TODO: specify what could change between the two?
65
61
//
66
62
// Returns `None` if `offset` is out of bounds.
67
63
pub ( crate ) fn load_array_element_constant_index (
@@ -76,19 +72,10 @@ impl AcirMem {
76
72
}
77
73
78
74
// Check the memory_map to see if the element is there
79
- if let Some ( internal_var) = self . array_map_mut ( array. id ) . get ( & offset) {
80
- return Some ( internal_var. clone ( ) ) ;
81
- } ;
82
-
83
- let array_element = array. values [ offset as usize ] . clone ( ) ;
84
-
85
- // Compiler sanity check
86
- //
87
- // Since the only time we take the array values
88
- // from the array is when it has been defined in the
89
- // ABI. We know that it must have been initialized with a `Witness`
90
- array_element. cached_witness ( ) . expect ( "ICE: since the value is not in the memory_map it must have came from the ABI, so it is a Witness" ) ;
91
-
92
- Some ( array_element)
75
+ let array_element = self
76
+ . array_map_mut ( array. id )
77
+ . get ( & offset)
78
+ . expect ( "ICE: Could not find value at index {offset}" ) ;
79
+ Some ( array_element. clone ( ) )
93
80
}
94
81
}
0 commit comments