Fix bug/issue #33 (correctly access struct/array variables declared inside a FB -> r:=FB1.FB2.struct1.array1[3] )
authorMario de Sousa <msousa@fe.up.pt>
Wed, 18 Dec 2013 18:41:05 +0000
changeset 851 2c59c2b8fca4
parent 850 484beb3b1dcb
child 852 efb44e892582
Fix bug/issue #33 (correctly access struct/array variables declared inside a FB -> r:=FB1.FB2.struct1.array1[3] )
absyntax_utils/search_var_instance_decl.cc
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_inlinefcall.cc
stage4/generate_c/generate_c_st.cc
--- a/absyntax_utils/search_var_instance_decl.cc	Sat Sep 07 22:08:09 2013 +0100
+++ b/absyntax_utils/search_var_instance_decl.cc	Wed Dec 18 18:41:05 2013 +0000
@@ -136,11 +136,8 @@
 bool search_var_instance_decl_c::type_is_complex(symbol_c *symbol) {
   symbol_c *decl;
   
-  decl = this->get_decl(symbol);
+  decl = symbol->datatype;
   if (NULL == decl) ERROR;
-  decl = search_base_type_c::get_basetype_decl(decl);
-  if (NULL == decl) ERROR;
-  
   return ((typeid( *(decl) ) == typeid( array_specification_c                )) ||
 //        (typeid( *(decl) ) == typeid( array_spec_init_c                    )) ||  /* does not seem to be necessary */
           (typeid( *(decl) ) == typeid( structure_type_declaration_c         )) ||  
--- a/stage4/generate_c/generate_c_il.cc	Sat Sep 07 22:08:09 2013 +0100
+++ b/stage4/generate_c/generate_c_il.cc	Wed Dec 18 18:41:05 2013 +0000
@@ -394,8 +394,7 @@
       variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration;
       wanted_variablegeneration = complextype_base_vg;
       symbol->accept(*this);
-      if (search_var_instance_decl->type_is_complex(symbol))
-        s4o.print(",");
+      s4o.print(",");
       wanted_variablegeneration = complextype_suffix_vg;
       symbol->accept(*this);
       s4o.print(")");
--- a/stage4/generate_c/generate_c_inlinefcall.cc	Sat Sep 07 22:08:09 2013 +0100
+++ b/stage4/generate_c/generate_c_inlinefcall.cc	Wed Dec 18 18:41:05 2013 +0000
@@ -256,8 +256,7 @@
 
       wanted_variablegeneration = complextype_base_vg;
       symbol->accept(*this);
-      if (search_var_instance_decl->type_is_complex(symbol))
-        s4o.print(",");
+      s4o.print(",");
       wanted_variablegeneration = complextype_suffix_vg;
       symbol->accept(*this);
       s4o.print(")");
--- a/stage4/generate_c/generate_c_st.cc	Sat Sep 07 22:08:09 2013 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Wed Dec 18 18:41:05 2013 +0000
@@ -158,8 +158,7 @@
   variablegeneration_t old_wanted_variablegeneration = wanted_variablegeneration;
   wanted_variablegeneration = complextype_base_vg;
   symbol->accept(*this);
-  if (search_var_instance_decl->type_is_complex(symbol))
-    s4o.print(",");
+  s4o.print(",");
   wanted_variablegeneration = complextype_suffix_vg;
   symbol->accept(*this);
   s4o.print(")");