Fix bug while using complex type variables in Function and FunctionBlock interface
authorLaurent Bessard
Fri, 27 Jul 2012 15:43:32 +0200
changeset 410 c6486bd97392
parent 409 8d876ad522f4
child 411 3e21d98d0a71
Fix bug while using complex type variables in Function and FunctionBlock interface
stage4/generate_c/generate_c_il.cc
stage4/generate_c/generate_c_inlinefcall.cc
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_il.cc	Fri Jul 27 15:40:44 2012 +0200
+++ b/stage4/generate_c/generate_c_il.cc	Fri Jul 27 15:43:32 2012 +0200
@@ -649,16 +649,24 @@
 // SYM_REF2(structured_variable_c, record_variable, field_selector)
 void *visit(structured_variable_c *symbol) {
   TRACE("structured_variable_c");
+  unsigned int vartype = search_varfb_instance_type->get_vartype(symbol->record_variable);
+  bool type_is_complex = search_varfb_instance_type->type_is_complex();
   switch (wanted_variablegeneration) {
     case complextype_base_vg:
     case complextype_base_assignment_vg:
       symbol->record_variable->accept(*this);
+      if (!type_is_complex) {
+        s4o.print(".");
+        symbol->field_selector->accept(*this);
+      }
       break;
     case complextype_suffix_vg:
     case assignment_vg:
       symbol->record_variable->accept(*this);
-      s4o.print(".");
-      symbol->field_selector->accept(*this);
+      if (type_is_complex) {
+        s4o.print(".");
+        symbol->field_selector->accept(*this);
+      }
       break;
     default:
       if (this->is_variable_prefix_null()) {
--- a/stage4/generate_c/generate_c_inlinefcall.cc	Fri Jul 27 15:40:44 2012 +0200
+++ b/stage4/generate_c/generate_c_inlinefcall.cc	Fri Jul 27 15:43:32 2012 +0200
@@ -397,15 +397,23 @@
     // SYM_REF2(structured_variable_c, record_variable, field_selector)
     void *visit(structured_variable_c *symbol) {
       TRACE("structured_variable_c");
+      unsigned int vartype = search_varfb_instance_type->get_vartype(symbol->record_variable);
+      bool type_is_complex = search_varfb_instance_type->type_is_complex();
       if (generating_inlinefunction) {
         switch (wanted_variablegeneration) {
           case complextype_base_vg:
             symbol->record_variable->accept(*this);
+            if (!type_is_complex) {
+          	  s4o.print(".");
+          	  symbol->field_selector->accept(*this);
+            }
             break;
           case complextype_suffix_vg:
             symbol->record_variable->accept(*this);
-            s4o.print(".");
-            symbol->field_selector->accept(*this);
+            if (type_is_complex) {
+              s4o.print(".");
+              symbol->field_selector->accept(*this);
+            }
             break;
           default:
             print_getter(symbol);
--- a/stage4/generate_c/generate_c_st.cc	Fri Jul 27 15:40:44 2012 +0200
+++ b/stage4/generate_c/generate_c_st.cc	Fri Jul 27 15:43:32 2012 +0200
@@ -312,16 +312,24 @@
 // SYM_REF2(structured_variable_c, record_variable, field_selector)
 void *visit(structured_variable_c *symbol) {
   TRACE("structured_variable_c");
+  unsigned int vartype = search_varfb_instance_type->get_vartype(symbol->record_variable);
+  bool type_is_complex = search_varfb_instance_type->type_is_complex();
   switch (wanted_variablegeneration) {
     case complextype_base_vg:
     case complextype_base_assignment_vg:
       symbol->record_variable->accept(*this);
+      if (!type_is_complex) {
+    	s4o.print(".");
+    	symbol->field_selector->accept(*this);
+      }
       break;
     case complextype_suffix_vg:
     case assignment_vg:
       symbol->record_variable->accept(*this);
-      s4o.print(".");
-      symbol->field_selector->accept(*this);
+      if (type_is_complex) {
+        s4o.print(".");
+        symbol->field_selector->accept(*this);
+      }
       break;
     default:
       if (this->is_variable_prefix_null()) {