diff options
-rw-r--r-- | 010vm.cc | 3 | ||||
-rw-r--r-- | 030container.cc | 5 | ||||
-rw-r--r-- | 033exclusive_container.cc | 4 |
3 files changed, 5 insertions, 7 deletions
diff --git a/010vm.cc b/010vm.cc index 93145185..5b50b604 100644 --- a/010vm.cc +++ b/010vm.cc @@ -169,10 +169,9 @@ enum kind_of_type { struct type_info { string name; kind_of_type kind; - int size; // only if type is not primitive; primitives and addresses have size 1 (except arrays are dynamic) vector<reagent> elements; // End type_info Fields - type_info() :kind(PRIMITIVE), size(0) {} + type_info() :kind(PRIMITIVE) {} }; enum primitive_recipes { diff --git a/030container.cc b/030container.cc index b4627355..dc3de8b4 100644 --- a/030container.cc +++ b/030container.cc @@ -3,7 +3,7 @@ :(before "End Mu Types Initialization") //: We'll use this container as a running example, with two number elements. type_ordinal point = put(Type_ordinal, "point", Next_type_ordinal++); -get_or_insert(Type, point).size = 2; +get_or_insert(Type, point); // initialize get(Type, point).kind = CONTAINER; get(Type, point).name = "point"; get(Type, point).elements.push_back(reagent("x:number")); @@ -36,7 +36,7 @@ def main [ // A more complex container, containing another container as one of its // elements. type_ordinal point_number = put(Type_ordinal, "point-number", Next_type_ordinal++); -get_or_insert(Type, point_number).size = 2; +get_or_insert(Type, point_number); // initialize get(Type, point_number).kind = CONTAINER; get(Type, point_number).name = "point-number"; get(Type, point_number).elements.push_back(reagent("xy:point")); @@ -423,7 +423,6 @@ void insert_container(const string& command, kind_of_type kind, istream& in) { trace(9993, "parse") << " element: " << to_string(info.elements.back()) << end(); // End Load Container Element Definition } - info.size = SIZE(info.elements); } void replace_unknown_types_with_unique_ordinals(type_tree* type, const type_info& info) { diff --git a/033exclusive_container.cc b/033exclusive_container.cc index 5c1fe6ad..2a006a99 100644 --- a/033exclusive_container.cc +++ b/033exclusive_container.cc @@ -8,7 +8,7 @@ //: We'll use this container as a running example, with two number elements. { type_ordinal tmp = put(Type_ordinal, "number-or-point", Next_type_ordinal++); -get_or_insert(Type, tmp).size = 2; +get_or_insert(Type, tmp); // initialize get(Type, tmp).kind = EXCLUSIVE_CONTAINER; get(Type, tmp).name = "number-or-point"; get(Type, tmp).elements.push_back(reagent("i:number")); @@ -35,7 +35,7 @@ if (t.kind == EXCLUSIVE_CONTAINER) { // size of an exclusive container is the size of its largest variant // (So like containers, it can't contain arrays.) int result = 0; - for (int i = 0; i < t.size; ++i) { + for (int i = 0; i < SIZE(t.elements); ++i) { reagent tmp; tmp.type = new type_tree(*type); int size = size_of(variant_type(tmp, i)); |