about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-07 10:27:57 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-07 10:27:57 -0800
commitf7c58ffdc25c18516ed05e90cc4fd4b09a27682a (patch)
treefdfec43575ff4fbe3306852be4a8d29f1ad80b2a
parent9f7f62eda3d591eb66db6ddc2c9a646a1a9fd6d1 (diff)
downloadmu-f7c58ffdc25c18516ed05e90cc4fd4b09a27682a.tar.gz
3646
-rw-r--r--032array.cc44
1 files changed, 22 insertions, 22 deletions
diff --git a/032array.cc b/032array.cc
index 7344ffe1..0026bf95 100644
--- a/032array.cc
+++ b/032array.cc
@@ -122,6 +122,11 @@ container foo [
 ]
 $error: 0
 
+:(before "End insert_container Special-cases")
+else if (is_integer(type->name)) {  // sometimes types will contain non-type tags, like numbers for the size of an array
+  type->value = 0;
+}
+
 :(scenario container_disallows_dynamic_array_element)
 % Hide_errors = true;
 container foo [
@@ -129,9 +134,23 @@ container foo [
 ]
 +error: container 'foo' cannot determine size of element 'x'
 
-:(before "End insert_container Special-cases")
-else if (is_integer(type->name)) {  // sometimes types will contain non-type tags, like numbers for the size of an array
-  type->value = 0;
+:(before "End Load Container Element Definition")
+{
+  const type_tree* type = info.elements.back().type;
+  if (type && type->atom && type->name == "array") {
+    raise << "container '" << name << "' doesn't specify type of array elements for '" << info.elements.back().name << "'\n" << end();
+    continue;
+  }
+  if (type && !type->atom && type->left->atom && type->left->name == "array") {
+    if (!type->right) {
+      raise << "container '" << name << "' doesn't specify type of array elements for '" << info.elements.back().name << "'\n" << end();
+      continue;
+    }
+    if (type->right->atom) {  // array has no length
+      raise << "container '" << name << "' cannot determine size of element '" << info.elements.back().name << "'\n" << end();
+      continue;
+    }
+  }
 }
 
 //: disable the size mismatch check for 'merge' instructions since containers
@@ -153,25 +172,6 @@ def main [
 ]
 # no errors
 
-:(before "End Load Container Element Definition")
-{
-  const type_tree* type = info.elements.back().type;
-  if (type && type->atom && type->name == "array") {
-    raise << "container '" << name << "' doesn't specify type of array elements for '" << info.elements.back().name << "'\n" << end();
-    continue;
-  }
-  if (type && !type->atom && type->left->atom && type->left->name == "array") {
-    if (!type->right) {
-      raise << "container '" << name << "' doesn't specify type of array elements for '" << info.elements.back().name << "'\n" << end();
-      continue;
-    }
-    if (type->right->atom) {  // array has no length
-      raise << "container '" << name << "' cannot determine size of element '" << info.elements.back().name << "'\n" << end();
-      continue;
-    }
-  }
-}
-
 :(scenario code_inside_container)
 % Hide_errors = true;
 container card [