about summary refs log tree commit diff stats
path: root/052tangle.cc
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-04-27 00:39:49 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-04-27 00:47:23 -0700
commitb61557347aac31e6ba98dedbc16e49a69ff30912 (patch)
tree634342dfc937c8824fcd1a719adebedd9d52eef3 /052tangle.cc
parent331f6524488eaee36cc659363b6ba8b12e2b17df (diff)
downloadmu-b61557347aac31e6ba98dedbc16e49a69ff30912.tar.gz
2872 - tangle directive spurious errors fixed
Diffstat (limited to '052tangle.cc')
-rw-r--r--052tangle.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/052tangle.cc b/052tangle.cc
index 9c64bd00..896a073d 100644
--- a/052tangle.cc
+++ b/052tangle.cc
@@ -133,14 +133,15 @@ bool is_waypoint(string label) {
 }
 
 //: complain about unapplied fragments
-:(before "End Globals")
-bool Transform_check_insert_fragments_Ran = false;
-:(after "Transform.push_back(insert_fragments)")
-Transform.push_back(check_insert_fragments);  // idempotent
+//: This can't run during transform because later (shape-shifting recipes)
+//: we'll encounter situations where fragments might get used long after
+//: they're loaded, and we might run transform_all in between. To avoid
+//: spurious errors, run this check right at the end, after all code is
+//: loaded, right before we run main.
+:(before "End Commandline Parsing")
+check_insert_fragments();
 :(code)
-void check_insert_fragments(unused recipe_ordinal) {
-  if (Transform_check_insert_fragments_Ran) return;
-  Transform_check_insert_fragments_Ran = true;
+void check_insert_fragments() {
   for (map<string, recipe>::iterator p = Before_fragments.begin(); p != Before_fragments.end(); ++p) {
     if (!contains_key(Fragments_used, p->first))
       raise << "could not locate insert before " << p->first << '\n' << end();