2818
This commit is contained in:
parent
9f73b16511
commit
a5401241a1
3
010vm.cc
3
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 {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue
Block a user