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 alue='b1a672a2025a5236f09845e13aeb560b01a7d685'/>
path: root/html/counters.mu.html
blob: 6b5dd5d43528a6899d04765f184fc19c4a7cdecb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55