stage4/generate_c/generate_c_il.cc
changeset 345 894c0e6d951c
parent 344 8f71c46a0a55
child 355 30db860bd3bd
--- a/stage4/generate_c/generate_c_il.cc	Wed Jul 13 12:44:12 2011 +0200
+++ b/stage4/generate_c/generate_c_il.cc	Wed Jul 13 13:40:14 2011 +0200
@@ -1662,17 +1662,15 @@
     XXX_function("__TIME_ADD", &(this->default_variable_name), this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-    return NULL;
-  }
-  if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
+  }
+  else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
       search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
 	NUM_operator_result_type();
 	XXX_operator(&(this->default_variable_name), " += ", this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-    return NULL;
-  }
-  ERROR;
+  }
+  else {ERROR;}
   return NULL;
 }
 
@@ -1682,17 +1680,15 @@
     XXX_function("__TIME_SUB", &(this->default_variable_name), this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-    return NULL;
-  }
-  if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
+  }
+  else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
       search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
 	NUM_operator_result_type();
 	XXX_operator(&(this->default_variable_name), " -= ", this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-    return NULL;
-  }
-  ERROR;
+  }
+  else {ERROR;}
   return NULL;
 }
 
@@ -1700,18 +1696,16 @@
   if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
       search_expression_type->is_integer_type(this->current_operand_type)) {
     XXX_function("__TIME_MUL", &(this->default_variable_name), this->current_operand);
-    /* the data type resulting from this operation... */
-    return NULL;
-  }
-  if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
+    /* the data type resulting from this operation is unchanged! */
+  }
+  else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
       search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
 	NUM_operator_result_type();
     XXX_operator(&(this->default_variable_name), " *= ", this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-    return NULL;
-  }
-  ERROR;
+  }
+  else {ERROR;}
   return NULL;
 }
 
@@ -1719,17 +1713,17 @@
   if (search_expression_type->is_time_type(this->default_variable_name.current_type) &&
       search_expression_type->is_integer_type(this->current_operand_type)) {
     XXX_function("__TIME_DIV", &(this->default_variable_name), this->current_operand);
-    /* the data type resulting from this operation... */
-    return NULL;
-  }
-  if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
+    /* the data type resulting from this operation is unchanged! */
+  }
+  else if (search_expression_type->is_num_type(this->default_variable_name.current_type) &&
       search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
 	NUM_operator_result_type();
 	XXX_operator(&(this->default_variable_name), " /= ", this->current_operand);
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
-  }
-  ERROR;
+    return NULL;
+  }
+  else {ERROR;}
   return NULL;
 }
 
@@ -1741,53 +1735,59 @@
     /* the data type resulting from this operation... */
     this->default_variable_name.current_type = this->current_operand_type;
   }
-  ERROR;
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(GT_operator_c *symbol)	{
   if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
-      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__gt_");
-  ERROR;
+      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__gt_");
+  }
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(GE_operator_c *symbol)	{
   if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
-      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__ge_");
-  ERROR;
+      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__ge_");
+  }
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(EQ_operator_c *symbol)	{
-  if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__eq_");
-  ERROR;
+  if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__eq_");
+  }
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(LT_operator_c *symbol)	{
   if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
-      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__lt_");
-  ERROR;
+      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__lt_");
+  }
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(LE_operator_c *symbol)	{
   if (!search_base_type.type_is_enumerated(this->default_variable_name.current_type) &&
-      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__le_");
-  ERROR;
+      search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__le_");
+  }
+  else {ERROR;}
   return NULL;
 }
 
 void *visit(NE_operator_c *symbol)	{
-  if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type))
-    return CMP_operator(this->current_operand, "__ne_");
-  ERROR;
+  if (search_expression_type->is_same_type(this->default_variable_name.current_type, this->current_operand_type)) {
+    CMP_operator(this->current_operand, "__ne_");
+  }
+  else {ERROR;}
   return NULL;
 }