diff options
Diffstat (limited to '030container.cc')
-rw-r--r-- | 030container.cc | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/030container.cc b/030container.cc index 572e6a2a..6d16d689 100644 --- a/030container.cc +++ b/030container.cc @@ -212,13 +212,6 @@ void compute_container_sizes(const type_tree* type, set<type_tree>& pending_meta if (type->left->name == "address") { compute_container_sizes(type->right, pending_metadata, location_for_error_messages); } - else if (type->left->name == "array") { - const type_tree* element_type = type->right; - // hack: support both array:num:3 and array:address:num - if (!element_type->atom && element_type->right && element_type->right->atom && is_integer(element_type->right->name)) - element_type = element_type->left; - compute_container_sizes(element_type, pending_metadata, location_for_error_messages); - } // End compute_container_sizes Non-atom Special-cases return; } @@ -346,67 +339,6 @@ void test_container_sizes_from_address() { CHECK_EQ(get(Container_metadata, container.type).size, 2); } -void test_container_sizes_from_array() { - // a container we don't have the size for - reagent container("x:point"); - CHECK(!contains_key(Container_metadata, container.type)); - // scanning an array of the container precomputes the size of the container - reagent r("x:array:point"); - compute_container_sizes(r, ""); - CHECK(contains_key(Container_metadata, container.type)); - CHECK_EQ(get(Container_metadata, container.type).size, 2); -} - -void test_container_sizes_from_address_to_array() { - // a container we don't have the size for - reagent container("x:point"); - CHECK(!contains_key(Container_metadata, container.type)); - // scanning an address to an array of the container precomputes the size of the container - reagent r("x:address:array:point"); - compute_container_sizes(r, ""); - CHECK(contains_key(Container_metadata, container.type)); - CHECK_EQ(get(Container_metadata, container.type).size, 2); -} - -void test_container_sizes_from_static_array() { - // a container we don't have the size for - reagent container("x:point"); - int old_size = SIZE(Container_metadata); - // scanning an address to an array of the container precomputes the size of the container - reagent r("x:array:point:10"); - compute_container_sizes(r, ""); - CHECK(contains_key(Container_metadata, container.type)); - CHECK_EQ(get(Container_metadata, container.type).size, 2); - // no non-container types precomputed - CHECK_EQ(SIZE(Container_metadata)-old_size, 1); -} - -void test_container_sizes_from_address_to_static_array() { - // a container we don't have the size for - reagent container("x:point"); - int old_size = SIZE(Container_metadata); - // scanning an address to an array of the container precomputes the size of the container - reagent r("x:address:array:point:10"); - compute_container_sizes(r, ""); - CHECK(contains_key(Container_metadata, container.type)); - CHECK_EQ(get(Container_metadata, container.type).size, 2); - // no non-container types precomputed - CHECK_EQ(SIZE(Container_metadata)-old_size, 1); -} - -void test_container_sizes_from_repeated_address_and_array_types() { - // a container we don't have the size for - reagent container("x:point"); - int old_size = SIZE(Container_metadata); - // scanning repeated address and array types modifying the container precomputes the size of the container - reagent r("x:address:array:address:array:point:10"); - compute_container_sizes(r, ""); - CHECK(contains_key(Container_metadata, container.type)); - CHECK_EQ(get(Container_metadata, container.type).size, 2); - // no non-container types precomputed - CHECK_EQ(SIZE(Container_metadata)-old_size, 1); -} - //:: To access elements of a container, use 'get' //: 'get' takes a 'base' container and an 'offset' into it and returns the //: appropriate element of the container value. @@ -783,9 +715,6 @@ void replace_unknown_types_with_unique_ordinals(type_tree* type, const type_info if (contains_key(Type_ordinal, type->name)) { type->value = get(Type_ordinal, type->name); } - else if (is_integer(type->name)) { // sometimes types will contain non-type tags, like numbers for the size of an array - type->value = 0; - } // End insert_container Special-cases else if (type->name != "->") { // used in recipe types put(Type_ordinal, type->name, Next_type_ordinal++); |