Lots of bugs fixed
authorlbessard
Fri, 05 Oct 2007 17:58:44 +0200
changeset 65 c6d41c1287de
parent 64 ab704568fa25
child 66 501e9d494744
Lots of bugs fixed
stage4/generate_cc/function_call_param_iterator.cc
stage4/generate_cc/generate_cc.cc
stage4/generate_cc/generate_cc_st.cc
stage4/generate_cc/search_expression_type.cc
--- a/stage4/generate_cc/function_call_param_iterator.cc	Fri Oct 05 10:24:39 2007 +0200
+++ b/stage4/generate_cc/function_call_param_iterator.cc	Fri Oct 05 17:58:44 2007 +0200
@@ -466,7 +466,7 @@
 */
     void *visit(function_invocation_c *symbol) {
       TRACE("function_invocation_c");
-      if ((symbol_c *)symbol == f_call)
+      if ((symbol_c *)symbol == f_call && symbol->parameter_assignment_list != NULL)
         return symbol->parameter_assignment_list->accept(*this);
       else
         return NULL;
@@ -498,7 +498,10 @@
 // SYM_REF2(fb_invocation_c, fb_name, param_assignment_list)
     void *visit(fb_invocation_c *symbol) {
       TRACE("fb_invocation_c");
-      return symbol->param_assignment_list->accept(*this);
+      if (symbol->param_assignment_list != NULL)
+        return symbol->param_assignment_list->accept(*this);
+      else
+        return NULL;
     }
 
 /* helper symbol for fb_invocation */
--- a/stage4/generate_cc/generate_cc.cc	Fri Oct 05 10:24:39 2007 +0200
+++ b/stage4/generate_cc/generate_cc.cc	Fri Oct 05 17:58:44 2007 +0200
@@ -1168,7 +1168,7 @@
       /* (A.2) Global variables... */
       if (current_global_vars != NULL) {
         vardecl = new generate_cc_vardecl_c(&s4o,
-                      generate_cc_vardecl_c::localstatic_vf,
+                      generate_cc_vardecl_c::local_vf,
                       generate_cc_vardecl_c::global_vt);
         vardecl->print(current_global_vars);
         delete vardecl;
--- a/stage4/generate_cc/generate_cc_st.cc	Fri Oct 05 10:24:39 2007 +0200
+++ b/stage4/generate_cc/generate_cc_st.cc	Fri Oct 05 17:58:44 2007 +0200
@@ -349,7 +349,13 @@
 /* TODO: power expression... */
 void *visit(power_expression_c *symbol) {ERROR; return print_binary_expression(symbol->l_exp, symbol->r_exp, " ** ");}
 void *visit(neg_expression_c *symbol) {return print_unary_expression(symbol->exp, " -");}
-void *visit(not_expression_c *symbol) {return print_unary_expression(symbol->exp, search_expression_type->is_bool_type(symbol->exp)?"!":"~");}
+
+void *visit(not_expression_c *symbol) {
+  symbol_c *exp_type = search_expression_type->get_type(symbol->exp);
+  if (!search_expression_type->is_binary_type(exp_type))
+     ERROR;
+  return print_unary_expression(symbol->exp, search_expression_type->is_bool_type(exp_type)?"!":"~");
+}
 
 void *visit(function_invocation_c *symbol) {
   function_declaration_c *f_decl = function_symtable.find_value(symbol->function_name);
--- a/stage4/generate_cc/search_expression_type.cc	Fri Oct 05 10:24:39 2007 +0200
+++ b/stage4/generate_cc/search_expression_type.cc	Fri Oct 05 17:58:44 2007 +0200
@@ -472,9 +472,7 @@
   
   void *visit(not_expression_c *symbol) {
     symbol_c *exp_type = base_type((symbol_c *)symbol->exp->accept(*this));
-    if (typeid(*exp_type) == typeid(bool_type_name_c)) {return (void *)exp_type;}
-    ERROR;
-    return NULL;
+    return compute_boolean_expression(exp_type, exp_type);
   }
   
   void *visit(function_invocation_c *symbol) {