about summary refs log tree commit diff stats
path: root/032array.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-07 10:41:24 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-08 04:18:32 -0800
commit34068eb30b1795d14d206f7ae4f1ce50accb2529 (patch)
tree44d0d8798d07642d1f3fe6a5068074f86ded6331 /032array.cc
parentf7c58ffdc25c18516ed05e90cc4fd4b09a27682a (diff)
downloadmu-34068eb30b1795d14d206f7ae4f1ce50accb2529.tar.gz
3647
Diffstat (limited to '032array.cc')
-rw-r--r--032array.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/032array.cc b/032array.cc
index 0026bf95..7d189749 100644
--- a/032array.cc
+++ b/032array.cc
@@ -359,16 +359,17 @@ type_tree* array_element(const type_tree* type) {
 }
 
 int array_length(const reagent& x) {
+  // x should already be canonized.
   if (!x.type->atom && !x.type->right->atom && x.type->right->right->atom  // exactly 3 types
       && is_integer(x.type->right->right->name)) {  // third 'type' is a number
     // get size from type
     return to_integer(x.type->right->right->name);
   }
-  // this should never happen at transform time
-  // x should already be canonized.
+  // we should never get here at transform time
   return get_or_insert(Memory, x.value);
 }
 
+:(before "End Unit Tests")
 void test_array_length_compound() {
   put(Memory, 1, 3);
   put(Memory, 2, 14);
='n157' href='#n157'>157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218