Bug on located variables without name declaration fixed
authorlbessard
Thu, 03 Apr 2008 18:29:14 +0200
changeset 117 550c3bd2df16
parent 116 f81527b1287b
child 118 d4cf7ea933a4
Bug on located variables without name declaration fixed
stage4/generate_c/search_var_instance_decl.cc
--- a/stage4/generate_c/search_var_instance_decl.cc	Thu Apr 03 18:28:10 2008 +0200
+++ b/stage4/generate_c/search_var_instance_decl.cc	Thu Apr 03 18:29:14 2008 +0200
@@ -300,7 +300,7 @@
     void *visit(global_var_spec_c *symbol) {
       if (symbol->global_var_name != NULL && compare_identifiers(symbol->global_var_name, search_name) == 0)
           return current_type_decl;
-      else 
+      else
         return symbol->location->accept(*this);
     }
 
@@ -320,11 +320,12 @@
 /* variable_name -> may be NULL ! */
 //SYM_REF4(located_var_decl_c, variable_name, location, located_var_spec_init, unused)
     void *visit(located_var_decl_c *symbol) {
-      if (symbol->variable_name != NULL && compare_identifiers(symbol->variable_name, search_name) == 0) {
+      if (symbol->variable_name != NULL && compare_identifiers(symbol->variable_name, search_name) == 0)
         return symbol->located_var_spec_init;
-      }
-      else
-        return NULL;
+      else {
+        current_type_decl = symbol->located_var_spec_init;
+        return symbol->location->accept(*this);
+      }
     }
 
 /*| global_var_spec ':' [located_var_spec_init|function_block_type_name] */
@@ -332,14 +333,15 @@
 // SYM_REF2(global_var_decl_c, global_var_spec, type_specification)
 // TODO!!
 
-/*| global_var_name location */
-// SYM_REF2(global_var_spec_c, global_var_name, location)
-// TODO!!
-
 /*  AT direct_variable */
 // SYM_REF2(location_c, direct_variable, unused)
-// TODO!!
-
+    void *visit(location_c *symbol) {
+      if (compare_identifiers(symbol->direct_variable, search_name) == 0)
+        return current_type_decl;
+      else
+        return NULL;
+    }
+        
 /*| global_var_list ',' global_var_name */
 // SYM_LIST(global_var_list_c)
 // TODO!!