diff options
-rw-r--r-- | 010vm.cc | 17 | ||||
-rw-r--r-- | 040brace.cc | 1 | ||||
-rw-r--r-- | 057static_dispatch.cc | 4 | ||||
-rw-r--r-- | 059generic_recipe.cc | 4 | ||||
-rw-r--r-- | edit/003-shortcuts.mu | 2 |
5 files changed, 25 insertions, 3 deletions
diff --git a/010vm.cc b/010vm.cc index 08858594..cade8df8 100644 --- a/010vm.cc +++ b/010vm.cc @@ -392,6 +392,10 @@ string dump_types(const reagent& x) { void dump_types(const type_tree* type, ostream& out) { // abbreviate a single-node tree to just its contents + if (!type) { + out << "NULLNULLNULL"; // should never happen + return; + } if (!type->left && !type->right) { dump_type_name(type->value, out); return; @@ -487,6 +491,19 @@ void dump_recipe(const string& recipe_name) { cout << "]\n"; } +//? string debug_string(const recipe& x) { +//? for (long long int index = 0; index < SIZE(x.steps); ++index) { +//? const instruction& inst = x.steps.at(index); +//? cerr << "inst: " << inst.to_string() << '\n'; +//? for (long long int i = 0; i < SIZE(inst.ingredients); ++i) { +//? cerr << " " << inst.ingredients.at(i).to_string() << " => " << dump_types(inst.ingredients.at(i)) << '\n'; +//? } +//? cerr << "--\n"; +//? for (long long int i = 0; i < SIZE(inst.products); ++i) +//? cerr << " " << inst.products.at(i).to_string() << " => " << dump_types(inst.products.at(i)) << '\n'; +//? } +//? } + void skip_whitespace(istream& in) { while (!in.eof() && isspace(in.peek()) && in.peek() != '\n') { in.get(); diff --git a/040brace.cc b/040brace.cc index ae7c9736..9fc251c7 100644 --- a/040brace.cc +++ b/040brace.cc @@ -115,6 +115,7 @@ void transform_braces(const recipe_ordinal r) { // if implicit, compute target reagent target; target.type = new type_tree(get(Type_ordinal, "offset")); + target.properties.at(0).second = new string_tree("offset"); target.set_value(0); if (open_braces.empty()) raise_error << inst.old_name << " needs a '{' before\n" << end(); diff --git a/057static_dispatch.cc b/057static_dispatch.cc index 6fe696ba..e294b16d 100644 --- a/057static_dispatch.cc +++ b/057static_dispatch.cc @@ -105,7 +105,9 @@ recipe test a:number, b:number -> z:number [ +mem: storing 2 in location 7 //: after insert_fragments (tangle) and before computing operation ids -:(before "Transform.push_back(deduce_types_from_header)") +//: after filling in all missing types (because we'll be specializing generics +//: here in a later layer) +:(after "Transform.push_back(deduce_types_from_header)") Transform.push_back(resolve_ambiguous_calls); // idempotent :(code) diff --git a/059generic_recipe.cc b/059generic_recipe.cc index dd6eb94a..811869b6 100644 --- a/059generic_recipe.cc +++ b/059generic_recipe.cc @@ -131,11 +131,11 @@ recipe_ordinal new_variant(recipe_ordinal exemplar, const instruction& inst) { recently_added_recipes.push_back(new_recipe_ordinal); put(Recipe, new_recipe_ordinal, get(Recipe, exemplar)); recipe& new_recipe = get(Recipe, new_recipe_ordinal); + new_recipe.name = new_name; // Since the exemplar never ran any transforms, we have to redo some of the // work of the check_types_by_name transform while supporting type-ingredients. compute_type_names(new_recipe); // that gives enough information to replace type-ingredients with concrete types - new_recipe.name = new_name; map<string, const string_tree*> mappings; compute_type_ingredient_mappings(get(Recipe, exemplar), inst, mappings); replace_type_ingredients(new_recipe, mappings); @@ -149,6 +149,7 @@ recipe_ordinal new_variant(recipe_ordinal exemplar, const instruction& inst) { } void compute_type_names(recipe& variant) { + trace(9993, "transform") << "compute type names: " << variant.name << end(); map<string, string_tree*> type_names; for (long long int i = 0; i < SIZE(variant.ingredients); ++i) { save_or_deduce_type_name(variant.ingredients.at(i), type_names); @@ -158,6 +159,7 @@ void compute_type_names(recipe& variant) { } for (long long int i = 0; i < SIZE(variant.steps); ++i) { instruction& inst = variant.steps.at(i); + trace(9993, "transform") << " instruction: " << inst.to_string() << end(); for (long long int in = 0; in < SIZE(inst.ingredients); ++in) { save_or_deduce_type_name(inst.ingredients.at(in), type_names); } diff --git a/edit/003-shortcuts.mu b/edit/003-shortcuts.mu index 91f3246d..88a67e26 100644 --- a/edit/003-shortcuts.mu +++ b/edit/003-shortcuts.mu @@ -1637,7 +1637,7 @@ recipe delete-to-end-of-line editor:address:editor-data -> result:address:duplex loop } # snip it out - result:address:duplex-list:character <- next-duplex start # XXX: segfault on deleting this type + result <- next-duplex start remove-duplex-between start, end ] |