Fix stage4 for compare expressions.
authorManuele Conti <conti.ma@alice.it>
Sat, 06 Oct 2012 14:21:04 +0200
changeset 694 a010763dd4cb
parent 693 51a2fa6441b9
child 695 5760f1043ba4
Fix stage4 for compare expressions.
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_st.cc	Fri Oct 26 10:11:28 2012 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Sat Oct 06 14:21:04 2012 +0200
@@ -467,50 +467,50 @@
 }
 
 void *visit(equ_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("EQ_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("EQ_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " == ");
 }
 
 void *visit(notequ_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("NE_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("NE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " != ");
 }
 
 void *visit(lt_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("LT_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("LT_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " < ");
 }
 
 void *visit(gt_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("GT_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("GT_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " > ");
 }
 
 void *visit(le_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("LE_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("LE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " <= ");
 }
 
 void *visit(ge_expression_c *symbol) {
-  if (get_datatype_info_c::is_TIME_compatible      (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->datatype) ||
-      get_datatype_info_c::is_ANY_STRING_compatible(symbol->datatype))
-    return print_compare_function("GE_", symbol->datatype, symbol->l_exp, symbol->r_exp);
+  if (get_datatype_info_c::is_TIME_compatible      (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_DATE_compatible  (symbol->l_exp->datatype) ||
+      get_datatype_info_c::is_ANY_STRING_compatible(symbol->l_exp->datatype))
+    return print_compare_function("GE_", symbol->l_exp->datatype, symbol->l_exp, symbol->r_exp);
   return print_binary_expression(symbol->l_exp, symbol->r_exp, " >= ");
 }