From d215081d872f776a3d49ab54abf450f20d39572c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 30 Jan 2016 22:30:08 -0800 Subject: 2621 - bugfix: empty shape-shifting recipes My transform pipeline ignores empty recipes, but when I specialized shape-shifting ones I forgot that check. --- 059shape_shifting_recipe.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/059shape_shifting_recipe.cc b/059shape_shifting_recipe.cc index 5b423e9a..dcd041ac 100644 --- a/059shape_shifting_recipe.cc +++ b/059shape_shifting_recipe.cc @@ -77,14 +77,16 @@ if (best_score == -1) { recipe_ordinal new_recipe_ordinal = new_variant(exemplar, inst, caller_recipe); if (new_recipe_ordinal == 0) goto done_constructing_variant; variants.push_back(new_recipe_ordinal); + recipe& variant = get(Recipe, new_recipe_ordinal); // perform all transforms on the new specialization - const string& new_name = get(Recipe, variants.back()).name; - trace(9992, "transform") << "transforming new specialization: " << new_name << end(); - for (long long int t = 0; t < SIZE(Transform); ++t) { - (*Transform.at(t))(new_recipe_ordinal); + if (!variant.steps.empty()) { + trace(9992, "transform") << "transforming new specialization: " << variant.name << end(); + for (long long int t = 0; t < SIZE(Transform); ++t) { + (*Transform.at(t))(new_recipe_ordinal); + } } - get(Recipe, new_recipe_ordinal).transformed_until = SIZE(Transform)-1; - inst.name = get(Recipe, variants.back()).name; + variant.transformed_until = SIZE(Transform)-1; + inst.name = variant.name; trace(9992, "transform") << "new specialization: " << inst.name << end(); } done_constructing_variant:; @@ -533,6 +535,15 @@ container foo:_t [ +mem: storing 14 in location 20 +mem: storing 15 in location 21 +:(scenario shape_shifting_recipe_empty) +recipe main [ + foo 1 +] +# shape-shifting recipe with no body +recipe foo a:_t [ +] +# shouldn't crash + :(scenario shape_shifting_recipe_handles_shape_shifting_new_ingredient) recipe main [ 1:address:shared:foo:point <- bar 3 -- cgit 1.4.1-2-gfad0
path: root/src/LYGetFile.c
blob: 452126015bafa055a5b67b5d9edfc6720948eda9 (plain) (tree)