about summary refs log tree commit diff stats
path: root/052tangle.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-24 18:58:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-24 18:58:23 -0700
commitfb9bcd34bfb65d69af8224cc1f75468a9f23e318 (patch)
treec2f3b1d2053cca4560b9e916328738e20f843351 /052tangle.cc
parent2feefe3ffe0cf4847037b190b831325e70cc9723 (diff)
downloadmu-fb9bcd34bfb65d69af8224cc1f75468a9f23e318.tar.gz
3001
Diffstat (limited to '052tangle.cc')
-rw-r--r--052tangle.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/052tangle.cc b/052tangle.cc
index db1416a8..c3ad4485 100644
--- a/052tangle.cc
+++ b/052tangle.cc
@@ -69,14 +69,18 @@ tangle_done = false;
 
 :(code)
 void insert_fragments(const recipe_ordinal r) {
+  insert_fragments(get(Recipe, r));
+}
+
+void insert_fragments(recipe& r) {
   bool made_progress = true;
   int pass = 0;
   while (made_progress) {
     made_progress = false;
     // create a new vector because insertions invalidate iterators
     vector<instruction> result;
-    for (int i = 0; i < SIZE(get(Recipe, r).steps); ++i) {
-      const instruction& inst = get(Recipe, r).steps.at(i);
+    for (int i = 0; i < SIZE(r.steps); ++i) {
+      const instruction& inst = r.steps.at(i);
       if (!inst.is_label || !is_waypoint(inst.label) || inst.tangle_done) {
         result.push_back(inst);
         continue;
@@ -85,7 +89,7 @@ void insert_fragments(const recipe_ordinal r) {
       made_progress = true;
       Fragments_used.insert(inst.label);
       ostringstream prefix;
-      prefix << '+' << get(Recipe, r).name << '_' << pass << '_' << i;
+      prefix << '+' << r.name << '_' << pass << '_' << i;
       // ok to use contains_key even though Before_fragments uses [],
       // because appending an empty recipe is a noop
       if (contains_key(Before_fragments, inst.label))
@@ -94,7 +98,7 @@ void insert_fragments(const recipe_ordinal r) {
       if (contains_key(After_fragments, inst.label))
         append_fragment(result, After_fragments[inst.label].steps, prefix.str());
     }
-    get(Recipe, r).steps.swap(result);
+    r.steps.swap(result);
     ++pass;
   }
 }