Fix bug on initialization of temp variables not using setter
authorlaurent
Wed, 06 Jul 2011 12:19:30 +0200
changeset 334 63b52a8a12f3
parent 333 b495a49f5038
child 335 96d2efda3d8d
child 338 3037bb7e8a82
Fix bug on initialization of temp variables not using setter
stage4/generate_c/generate_c_vardecl.cc
--- a/stage4/generate_c/generate_c_vardecl.cc	Wed Jul 06 12:01:46 2011 +0200
+++ b/stage4/generate_c/generate_c_vardecl.cc	Wed Jul 06 12:19:30 2011 +0200
@@ -163,7 +163,7 @@
         s4o.print("(");
         print_variable_prefix();
         symbol->elements[i]->accept(*this);
-        s4o.print(", temp);\n");
+        s4o.print(",temp);\n");
       }
       return NULL;
     }
@@ -918,6 +918,10 @@
         	this->current_var_type_symbol->accept(*this);
             s4o.print(" ");
           }
+          else if (wanted_varformat == init_vf) {
+        	s4o.print(SET_VAR);
+        	s4o.print("(");
+          }
           print_variable_prefix();
           list->elements[i]->accept(*this);
           if (wanted_varformat != local_vf) {
@@ -953,6 +957,11 @@
               s4o.print(s4o.indent_spaces);
               s4o.print("}\n");
             }
+        	else if (wanted_varformat == init_vf) {
+        	  s4o.print(",");
+        	  this->current_var_init_symbol->accept(*this);
+        	  s4o.print(");\n");
+        	}
         	else {
         	  if (this->current_var_init_symbol != NULL) {
                 s4o.print(" = ");