about summary refs log tree commit diff stats
path: root/cpp/024brace
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-18 22:09:31 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-18 22:09:31 -0700
commit9cc16d04958753a62474d13bd823f13a33a6a0a3 (patch)
tree2fc4b37f8fda0d8ac7662cdf5cf05a942b428f45 /cpp/024brace
parentb1299d632715669c90dde918f5522c776b853e66 (diff)
downloadmu-9cc16d04958753a62474d13bd823f13a33a6a0a3.tar.gz
956
Cleaner way to signal that a reagent's value has been computed.
Diffstat (limited to 'cpp/024brace')
-rw-r--r--cpp/024brace13
1 files changed, 7 insertions, 6 deletions
diff --git a/cpp/024brace b/cpp/024brace
index d97f228f..aa8c7a4c 100644
--- a/cpp/024brace
+++ b/cpp/024brace
@@ -67,7 +67,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = open_braces.top()-index;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump " << ing.value << ":offset";
         trace("after-brace") << index << ": " << ing.to_string();
@@ -83,7 +83,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = matching_brace(open_braces.top(), braces) - index - 1;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump " << ing.value << ":offset";
       }
@@ -97,7 +97,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = open_braces.top()-index;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump-if " << inst.ingredients[0].name << ", " << ing.value << ":offset";
       }
@@ -111,7 +111,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = matching_brace(open_braces.top(), braces) - index - 1;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump-if " << inst.ingredients[0].name << ", " << ing.value << ":offset";
       }
@@ -125,7 +125,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = open_braces.top()-index;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump-unless " << inst.ingredients[0].name << ", " << ing.value << ":offset";
       }
@@ -139,7 +139,7 @@ void transform_braces(const recipe_number r) {
       else {
         reagent ing(0);  // literal
         ing.value = matching_brace(open_braces.top(), braces) - index - 1;
-        ing.name.clear();
+        ing.initialized = true;
         inst.ingredients.push_back(ing);
         trace("after-brace") << "jump-unless " << inst.ingredients[0].name << ", " << ing.value << ":offset";
       }
@@ -359,6 +359,7 @@ recipe factorial [
   {
     3:boolean <- equal 1:integer 1:literal
     break-if 3:boolean
+#    $print 1:integer
     2:integer <- multiply 2:integer, 1:integer
     1:integer <- subtract 1:integer, 1:literal
     loop