From f7c58ffdc25c18516ed05e90cc4fd4b09a27682a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 7 Nov 2016 10:27:57 -0800 Subject: 3646 --- 032array.cc | 44 ++++++++++++++++++++++---------------------- 1 file 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 [ -- cgit 1.4.1-2-gfad0