diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-08-13 16:36:51 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-08-13 16:37:56 -0700 |
commit | 590ccda599b2ba57b896305f6974abb11589558f (patch) | |
tree | c16b3096d8786711d4e1d80e72fcba7d1291490a /029tools.cc | |
parent | 1ad3fe9e6134353362c9a1318b4ba52d3ecc0d75 (diff) | |
download | mu-590ccda599b2ba57b896305f6974abb11589558f.tar.gz |
1989 - drop the default label for 'trace'
Diffstat (limited to '029tools.cc')
-rw-r--r-- | 029tools.cc | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/029tools.cc b/029tools.cc index 05753e4b..63addeb9 100644 --- a/029tools.cc +++ b/029tools.cc @@ -12,31 +12,18 @@ TRACE, Recipe_ordinal["trace"] = TRACE; :(before "End Primitive Recipe Implementations") case TRACE: { - 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'; //? 1 - trace(1, "app") << message << end(); - } - else { - raise << current_recipe_name() << ": 'trace' takes one or two ingredients rather than '" << current_instruction().to_string() << "'\n" << end(); + if (SIZE(current_instruction().ingredients) != 2) { + raise << current_recipe_name() << ": 'trace' takes two ingredients rather than '" << current_instruction().to_string() << "'\n" << end(); + break; } + 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; } -:(scenario trace_with_one_argument) -recipe main [ - trace [foo] -] -+app: foo - //: a smarter but more limited version of 'trace' :(before "End Primitive Recipe Declarations") |