diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-11-01 02:46:41 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-11-01 02:46:41 -0700 |
commit | aae198a93b03ca53a0eb2a661c0a8cc47780573f (patch) | |
tree | 77d8365b53ec06ba8b410dd0b3661c19c82eb745 /042name.cc | |
parent | aa68aeb34e2476af8bfea8ba11e08e3d5f1d19f1 (diff) | |
download | mu-aae198a93b03ca53a0eb2a661c0a8cc47780573f.tar.gz |
4099
Generalize commit 4089 to arbitrary closures, and not just the current 'space' or call frame. Now we should be treating spaces just like any other data structure, and reclaiming all addresses inside them when we need to. The cost: all spaces must now specify what recipe generated them (so they know how to interpret the array of locations) using the /names property. We can probably make this ergonomic with a little 'type inference'. But at least things are safe now.
Diffstat (limited to '042name.cc')
-rw-r--r-- | 042name.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/042name.cc b/042name.cc index 34e3efe0..6aaf6066 100644 --- a/042name.cc +++ b/042name.cc @@ -130,6 +130,13 @@ type_ordinal skip_addresses(type_tree* type) { return base_type->left->value; } +bool is_compound_type_starting_with(const type_tree* type, const string& expected_name) { + if (!type) return false; + if (type->atom) return false; + if (!type->left->atom) return false; + return type->left->value == get(Type_ordinal, expected_name); +} + int find_element_name(const type_ordinal t, const string& name, const string& recipe_name) { const type_info& container = get(Type, t); for (int i = 0; i < SIZE(container.elements); ++i) |