about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-06 11:54:20 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-06 11:54:20 -0800
commit4769dd2e8721e41769fce0a98523fe2e50035277 (patch)
tree964923da99f11e8a187fff8103b76f751035bb49
parent571791babc25dce11c188ece3530817a1c80391c (diff)
downloadmu-4769dd2e8721e41769fce0a98523fe2e50035277.tar.gz
3638
Reorder a couple of nonsensically-placed fragments.
-rw-r--r--055shape_shifting_container.cc31
1 files changed, 15 insertions, 16 deletions
diff --git a/055shape_shifting_container.cc b/055shape_shifting_container.cc
index 044e7089..352124c7 100644
--- a/055shape_shifting_container.cc
+++ b/055shape_shifting_container.cc
@@ -223,6 +223,13 @@ def main [
 # no other stores
 % CHECK_EQ(trace_count_prefix("mem", "storing"), 7);
 
+:(before "End variant_type Special-cases")
+if (contains_type_ingredient(element)) {
+  if (!type->right)
+    raise << "illegal type " << to_string(type) << " seems to be missing a type ingredient or three while computing variant type of exclusive-container\n" << end();
+  replace_type_ingredients(element.type, type->right, info);
+}
+
 :(scenario get_on_shape_shifting_container)
 container foo:_t [
   x:_t
@@ -295,15 +302,6 @@ replace_type_ingredients(element, full_type, exclusive_container_info, location_
 replace_type_ingredients(element, type, info, location_for_error_messages);
 if (contains_type_ingredient(element)) return;  // error raised elsewhere
 
-:(code)
-void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) {
-  if (contains_type_ingredient(element)) {
-    if (!caller_type->right)
-      raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end();
-    replace_type_ingredients(element.type, caller_type->right, info);
-  }
-}
-
 :(after "Compute size_of Container")
 assert(!contains_type_ingredient(type));
 :(after "Compute size_of Exclusive Container")
@@ -320,6 +318,14 @@ bool contains_type_ingredient(const type_tree* type) {
   return contains_type_ingredient(type->left) || contains_type_ingredient(type->right);
 }
 
+void replace_type_ingredients(reagent& element, const type_tree* caller_type, const type_info& info, const string& location_for_error_messages) {
+  if (contains_type_ingredient(element)) {
+    if (!caller_type->right)
+      raise << "illegal type " << names_to_string(caller_type) << " seems to be missing a type ingredient or three" << location_for_error_messages << '\n' << end();
+    replace_type_ingredients(element.type, caller_type->right, info);
+  }
+}
+
 // replace all type_ingredients in element_type with corresponding elements of callsite_type
 void replace_type_ingredients(type_tree* element_type, const type_tree* callsite_type, const type_info& container_info) {
   if (!callsite_type) return;  // error but it's already been raised above
@@ -681,10 +687,3 @@ def main [
   1:foo:bar <- merge 1/y, 23
 ]
 +error: main: too few ingredients in '1:foo:bar <- merge 1/y, 23'
-
-:(before "End variant_type Special-cases")
-if (contains_type_ingredient(element)) {
-  if (!type->right)
-    raise << "illegal type " << to_string(type) << " seems to be missing a type ingredient or three while computing variant type of exclusive-container\n" << end();
-  replace_type_ingredients(element.type, type->right, info);
-}
'#n238'>238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407