about summary refs log tree commit diff stats
path: root/029tools.cc
diff options
context:
space:
mode:
Diffstat (limited to '029tools.cc')
-rw-r--r--029tools.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/029tools.cc b/029tools.cc
index cd4123fa..587818ea 100644
--- a/029tools.cc
+++ b/029tools.cc
@@ -12,15 +12,22 @@ TRACE,
 Recipe_ordinal["trace"] = TRACE;
 :(before "End Primitive Recipe Implementations")
 case TRACE: {
-  if (SIZE(ingredients) != 2) {
-    raise << current_recipe_name() << ": 'trace' takes exactly two ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
-    break;
+  if (SIZE(ingredients) == 2) {
+    assert(is_literal(current_instruction().ingredients.at(0)));
+    string label = current_instruction().ingredients.at(0).name;
+    assert(is_literal(current_instruction().ingredients.at(1)));
+    string message = current_instruction().ingredients.at(1).name;
+    trace(1, label) << message << end();
+  }
+  else if (SIZE(ingredients) == 1) {
+    assert(is_literal(current_instruction().ingredients.at(0)));
+    string message = current_instruction().ingredients.at(0).name;
+    cerr << "tracing " << message << '\n';
+    trace(1, "app") << message << end();
+  }
+  else {
+    raise << current_recipe_name() << ": 'trace' takes one or two ingredients rather than '" << current_instruction().to_string() << "'\n" << end();
   }
-  assert(is_literal(current_instruction().ingredients.at(0)));
-  string label = current_instruction().ingredients.at(0).name;
-  assert(is_literal(current_instruction().ingredients.at(1)));
-  string message = current_instruction().ingredients.at(1).name;
-  trace(1, label) << message << end();
   break;
 }